.shop-page,
.item-page {
  --section-rule: rgb(30 32 39 / 30%);
  background: #e6e6e8;
}

.shop-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  min-height: calc(var(--header-h, 52px) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) max(var(--edge), env(safe-area-inset-right, 0px)) 0 max(var(--edge), env(safe-area-inset-left, 0px));
  border-bottom: 1px solid var(--section-rule);
}

.shop-page .shop-header {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #e6e6e8;
}

.shop-back {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font: 500 clamp(10px, .76vw, 13px)/1.3 var(--mono);
  text-transform: uppercase;
  letter-spacing: .065em;
}

.shop-back:hover {
  text-decoration: underline;
  text-underline-offset: .3em;
}

.shop-layout {
  width: min(100%, 1620px);
  margin-inline: auto;
  padding: clamp(28px, 4.8vw, 78px) var(--edge) max(40px, env(safe-area-inset-bottom, 0px));
}

.shop-controls h1 {
  margin: 0 0 clamp(18px, 2.5vw, 40px) -.045em;
  font-size: clamp(48px, 6.6vw, 104px);
  line-height: .92;
}

.capsule-catalog {
  width: 100%;
  min-width: 0;
  align-self: start;
  color: #101114;
}

.catalog-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 45px;
  margin-bottom: clamp(8px, .8vw, 14px);
  border-top: 1px solid var(--section-rule, rgb(30 32 39 / 30%));
  font: 500 clamp(10px, .73vw, 13px)/1.25 var(--mono);
  text-transform: uppercase;
  letter-spacing: .085em;
}

.catalog-filter {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.catalog-filter::after {
  position: absolute;
  right: 3px;
  width: 6px;
  height: 6px;
  border: solid currentColor;
  border-width: 0 1px 1px 0;
  transform: translateY(-2px) rotate(45deg);
  pointer-events: none;
  content: "";
}

.catalog-filter select {
  appearance: none;
  min-height: 44px;
  padding: 0 22px 0 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  cursor: pointer;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(20px, 2.2vw, 34px) clamp(10px, 1.28vw, 22px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.catalog-grid > li {
  display: flex;
  min-width: 0;
}

.catalog-grid > li[hidden],
.catalog-filter[hidden] {
  display: none;
}

.catalog-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  padding-bottom: clamp(9px, .95vw, 16px);
  border-bottom: 1px solid var(--section-rule, rgb(30 32 39 / 30%));
  scroll-margin-block-start: calc(var(--header-h, 52px) + 14px);
}

.catalog-card:focus-visible {
  outline-offset: 3px;
}

.catalog-photo {
  position: relative;
  display: block;
  width: 100%;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: #fff;
}

.catalog-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.catalog-photo .alternate-photo {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.catalog-caption {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 5px 8px;
  padding-top: clamp(9px, .85vw, 14px);
}

.catalog-name {
  font: 550 clamp(15px, 1.27vw, 22px)/1.07 var(--display);
  letter-spacing: -.033em;
}

.catalog-caption .arrow {
  --size: clamp(9px, .65vw, 12px);
  align-self: start;
  margin: .12em 2px 0 0;
}

.catalog-description {
  grid-column: 1 / -1;
  color: #48494f;
  font: 400 clamp(12px, .89vw, 15px)/1.33 var(--display);
}

@media (hover: hover) and (pointer: fine) {
  .catalog-card:hover .catalog-name {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: .18em;
  }
  .catalog-card:hover .alternate-photo { opacity: 1; }
}

@media (prefers-reduced-motion: no-preference) {
  .catalog-photo .alternate-photo { transition: opacity .18s ease-out; }
}

@media (max-width: 959px) {
  .catalog-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  .catalog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .catalog-photo { aspect-ratio: 1; }
}

@media (max-width: 380px) {
  .catalog-grid { column-gap: 9px; }
  .catalog-caption { column-gap: 5px; }
  .catalog-name { font-size: 14px; }
}
