.app-gallery__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  margin-bottom: clamp(20px, 3vw, 36px);
}

.app-gallery__viewport {
  position: relative;
}

.app-gallery__controls {
  position: absolute;
  z-index: 1;
  inset: 0;
  pointer-events: none;
}

.app-gallery__progress {
  display: block;
  flex: none;
  width: clamp(48px, 9vw, 100px);
  height: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--product-art);
}

.app-gallery__progress::before {
  content: "";
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--product);
  transform: scaleX(var(--gallery-progress, 0));
  transform-origin: left;
}

.app-gallery__controls button {
  position: absolute;
  top: var(--arrow-top);
  inset-inline-start: 0;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--product-dark);
  box-shadow: 0 2px 8px #18282026;
  pointer-events: auto;
  cursor: pointer;
  font-size: 21px;
  line-height: 1;
  translate: 0 -50%;
  transition: background-color 140ms ease-out, border-color 140ms ease-out, transform 110ms ease-out;
}

.app-gallery__controls button:last-child { inset-inline: auto 0; }

.app-gallery__controls button:hover:not([aria-disabled="true"]) {
  border-color: var(--product);
  color: var(--product);
}

.app-gallery__controls button:active:not([aria-disabled="true"]) {
  transform: scale(.93);
  border-color: var(--product);
  background: var(--product-art);
}

.app-gallery__controls button[aria-disabled="true"] {
  opacity: .52;
  pointer-events: none;
  cursor: default;
}

.app-gallery__track {
  position: relative;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding-bottom: 14px;
  scroll-snap-type: x mandatory;
  scrollbar-color: var(--product) transparent;
  scrollbar-width: thin;
}

.app-gallery__cards {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 30%;
  gap: clamp(12px, 2vw, 24px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.app-gallery__cards > li {
  min-width: 0;
  scroll-snap-align: start;
}

.app-gallery__cards figure {
  height: 100%;
  overflow: clip;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  transition: border-color 160ms ease-out;
}

.app-gallery__cards [aria-current="true"] figure {
  border-color: var(--product);
  border-color: color-mix(in srgb, var(--product) 62%, white);
}

.app-gallery__cards img {
  width: min(100% - 38px, 244px);
  height: auto;
  aspect-ratio: 260 / 564;
  object-fit: contain;
  margin-inline: auto;
}

.app-gallery__cards figcaption {
  padding: 16px clamp(14px, 2vw, 24px) 21px;
  border-top: 1px solid var(--line);
}

.app-gallery__cards h3 {
  color: var(--product-dark);
  font-size: 18px;
  letter-spacing: -.025em;
  line-height: 1.28;
}

.app-gallery__cards p {
  margin-top: 5px;
  color: var(--text);
  font-size: 14px;
}

@media (max-width: 920px) {
  .app-gallery__cards { grid-auto-columns: 44%; }
}

@media (max-width: 620px) {
  .app-gallery__cards { grid-auto-columns: min(86%, 320px); }
  .app-gallery__controls {
    inset-inline: min(0px, max(12px, var(--safe-side)) - var(--page-gutter));
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-gallery__controls button:active:not([aria-disabled="true"]) { transform: none; }
}
