/* Stoke Tiles redesign: collections (T5).
   Built from design/category-nested.html and category-nested-mobile.html.
   Loads after st-catalog.css, on category pages that have children. */

.st-collections {
  background: var(--st-white);
  border-bottom: 1px solid var(--st-divider);
  padding: 48px 0 48px var(--st-gutter-desktop);
  display: flex;
  flex-direction: column;
  gap: 28px;
  overflow: hidden;
}
.st-collections__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 32px;
  padding-right: var(--st-gutter-desktop);
}
.st-collections__title-row { display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; }
.st-collections__title-row .st-h2 { font-size: 40px; line-height: 1; }
.st-collections__note { font-size: var(--st-small); color: var(--st-taupe); }
.st-collections__controls { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.st-collections__all {
  min-height: var(--st-tap-min);
  margin-right: 16px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--st-bronze);
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--st-sans);
  font-size: var(--st-label);
  letter-spacing: var(--st-track-label);
  text-transform: uppercase;
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 6px;
  text-decoration-color: var(--st-gold);
}
.st-collections__all:hover { color: var(--st-espresso); }

.st-collections__viewport { overflow: hidden; }
.st-collections__track {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  gap: 20px;
  transition: transform 400ms ease;
}
.st-collections__track > li { width: 196px; flex-shrink: 0; list-style: none; }

.st-collection { display: flex; flex-direction: column; gap: 14px; text-decoration: none; color: var(--st-espresso); }
.st-collection__media {
  width: 196px;
  height: 196px;
  overflow: hidden;
  background: var(--st-stone);
  display: block;
}
.st-collection .st-collection__media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 600ms ease; }
.st-collection:hover .st-collection__media img { transform: scale(1.04); }
.st-collection__text { display: flex; flex-direction: column; gap: 4px; }
.st-collection__name { font-family: var(--st-serif); font-size: 22px; line-height: 1.2; font-weight: 500; }
.st-collection:hover .st-collection__name { color: var(--st-bronze); }
.st-collection__count { font-size: 13px; color: var(--st-taupe); }

/* ------------------------------------------------- All collections panel */

.st-cpanel { position: fixed; inset: 0; z-index: 1000; }
.st-cpanel[hidden] { display: none; }
.st-cpanel__scrim {
  position: absolute;
  inset: 0;
  background: rgba(24, 21, 18, 0.5);
  opacity: 0;
  transition: opacity 200ms ease;
}
.st-cpanel.is-open .st-cpanel__scrim { opacity: 1; }
.st-cpanel__inner {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(94vw, 560px);
  background: var(--st-ivory);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 240ms ease;
}
.st-cpanel.is-open .st-cpanel__inner { transform: translateX(0); }
@media (prefers-reduced-motion: reduce) {
  .st-cpanel__scrim,
  .st-cpanel__inner,
  .st-collections__track { transition: none; }
}

.st-cpanel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 32px 16px;
  border-bottom: 1px solid var(--st-linen);
  flex-shrink: 0;
}
.st-cpanel__title { margin: 0; font-family: var(--st-serif); font-weight: 500; font-size: 28px; line-height: 1.1; }
.st-cpanel__close {
  width: var(--st-tap-min);
  height: var(--st-tap-min);
  border: 0;
  background: transparent;
  color: var(--st-espresso);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.st-cpanel__search { padding: 16px 32px 0; flex-shrink: 0; }
.st-cpanel__search .st-field { width: 100%; }
.st-cpanel__az {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 16px 32px;
  border-bottom: 1px solid var(--st-divider);
  flex-shrink: 0;
}
.st-cpanel__az a {
  min-width: 28px;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--st-small);
  font-weight: 500;
  color: var(--st-bronze);
  text-decoration: none;
  border-radius: var(--st-radius);
}
.st-cpanel__az a:hover { background: var(--st-stone); color: var(--st-espresso); }
.st-cpanel__az a.is-off { color: var(--st-linen); pointer-events: none; }

.st-cpanel__list {
  flex-grow: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 32px 32px;
  scroll-behavior: smooth;
}
.st-cgroup { padding-top: 20px; }
.st-cgroup[hidden] { display: none; }
.st-cgroup__letter {
  margin: 0 0 8px;
  font-family: var(--st-sans);
  font-size: var(--st-eyebrow);
  letter-spacing: var(--st-track-eyebrow);
  text-transform: uppercase;
  color: var(--st-bronze);
  position: sticky;
  top: 0;
  background: var(--st-ivory);
  padding: 8px 0;
}
.st-cgroup__items { margin: 0; padding: 0; list-style: none; }
.st-cgroup__items li { list-style: none; }
.st-citem {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 64px;
  padding: 8px 0;
  color: var(--st-espresso);
  text-decoration: none;
  border-bottom: 1px solid var(--st-divider);
}
.st-citem:hover { color: var(--st-bronze); }
.st-citem__media {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  overflow: hidden;
  background: var(--st-stone);
  display: block;
}
.st-citem .st-citem__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.st-citem__name { flex-grow: 1; font-family: var(--st-serif); font-size: 20px; font-weight: 500; line-height: 1.2; }
.st-citem__count { font-size: 13px; color: var(--st-taupe); }
.st-cpanel__empty { padding: 32px 0; color: var(--st-taupe); }
body.st-cpanel-open { overflow: hidden; }

/* ------------------------------------ Search inside a sidebar filter group */

.st-fsearch { padding-bottom: 12px; }
.st-fsearch .st-field { width: 100%; height: var(--st-tap-min); font-size: var(--st-small); }
.st-fopts__empty { margin: 8px 0; font-size: var(--st-small); color: var(--st-taupe); }
/* A long list scrolls inside its group rather than pushing the page down. */
#st-f-collection-opts { max-height: 320px; overflow-y: auto; }

/* ---------------------------------------------------------------- Mobile */

@media (max-width: 1024px) {
  .st-collections { padding: 40px 0 40px var(--st-gutter-mobile); gap: 20px; }
  .st-collections__head { padding-right: var(--st-gutter-mobile); flex-direction: column; align-items: flex-start; gap: 16px; }
  .st-collections__title-row .st-h2 { font-size: 30px; }
  /* The arrows give way to a thumb swipe. */
  .st-collections__controls .st-icon-btn { display: none; }
  .st-collections__all { margin-right: 0; }
  .st-collections__viewport {
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-right: var(--st-gutter-mobile);
  }
  .st-collections__track { gap: 12px; }
  .st-collections__track > li { width: 152px; scroll-snap-align: start; }
  .st-collection__media { width: 152px; height: 152px; }
  .st-collection__name { font-size: 19px; }

  .st-cpanel__inner { width: 100%; }
  .st-cpanel__head,
  .st-cpanel__search,
  .st-cpanel__az,
  .st-cpanel__list { padding-left: var(--st-gutter-mobile); padding-right: var(--st-gutter-mobile); }
}


/* ============================================================ Design pass */

@media (max-width: 1024px) {
  .st-collections__title-row .st-h2 { font-size: 32px; }
  .st-collection__name { font-size: 18px; }
}
