/* Apple configurator (list view — one model card) */
.apple-configurator {
  padding: 12px 0 24px;
}
/* iPad: первый кадр только после полного initial setup (оси + галерея + dark-preview), без «полусборки». */
.apple-configurator.apple-configurator--bootstrapping {
  position: relative;
  min-height: 360px;
}
.apple-configurator.apple-configurator--bootstrapping .apple-configurator__card {
  opacity: 0;
  pointer-events: none;
}
.apple-configurator.apple-configurator--bootstrapping::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 24px;
  transform: translateX(-50%);
  width: calc(100% - 28px);
  max-width: 400px;
  height: 292px;
  border-radius: 26px;
  box-sizing: border-box;
  background: var(--app-loading-shimmer-gradient);
  background-size: var(--app-loading-shimmer-size);
  animation: appLoadingShimmer var(--app-loading-shimmer-duration) ease-in-out infinite;
  z-index: 1;
  pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
  .apple-configurator.apple-configurator--bootstrapping::before {
    animation: none;
    background: #ececf1;
  }
}
.apple-configurator__card.product-card {
  background: #fff;
  border-radius: 24px;
  padding: 14px 14px 20px;
  width: 100%;
  box-sizing: border-box;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.08),
    0 18px 42px rgba(15, 23, 42, 0.05);
  display: flex;
  flex-direction: column;
  gap: 0;
}
.apple-configurator__image-wrap {
  position: relative;
  isolation: isolate;
  width: 100%;
  height: 292px;
  min-height: 292px;
  margin: 0 auto;
  border-radius: 26px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 0 0;
  box-sizing: border-box;
  overflow: hidden;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92), 0 14px 30px rgba(15, 23, 42, 0.05);
  transition: background-color var(--motion-duration-short) var(--ease-out-apple);
}
.apple-configurator__image,
.apple-configurator__image-wrap .product-image {
  width: 88%;
  height: 88%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  margin-top: 0;
  display: block;
  will-change: transform, opacity;
  transition:
    opacity var(--motion-duration-gallery) var(--motion-ease-gallery),
    transform var(--motion-duration-gallery) var(--motion-ease-gallery),
    filter var(--motion-duration-gallery) var(--motion-ease-gallery);
  transform:
    translate3d(
      calc(var(--gallery-swipe-offset, 0px) + var(--gallery-parallax-x, 0px) + var(--gallery-transition-x, 0px)),
      calc(var(--gallery-parallax-y, 0px)),
      0
    )
    scale(var(--gallery-parallax-scale, 1));
}
.apple-configurator__image-wrap.is-pointer-active .apple-configurator__image,
.apple-configurator__image-wrap.is-pointer-active .product-image {
  filter: saturate(1.02);
}
.apple-configurator__image-wrap.is-gallery-active {
  cursor: grab;
}
.apple-configurator__image-wrap.is-gallery-active.is-dragging {
  cursor: grabbing;
}
.apple-configurator__image-wrap.is-dragging .apple-configurator__image,
.apple-configurator__image-wrap.is-dragging .product-image {
  transition-duration: 60ms;
}

.apple-configurator__image-wrap .app-gallery-stack {
  width: 88%;
  height: 88%;
  max-height: 100%;
  position: relative;
  flex-shrink: 0;
}
.apple-configurator__image.app-gallery-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  pointer-events: none;
  display: block;
  transition:
    opacity var(--motion-duration-gallery) var(--motion-ease-gallery),
    transform var(--motion-duration-gallery) var(--motion-ease-gallery),
    filter var(--motion-duration-gallery) var(--motion-ease-gallery);
  transform:
    translate3d(
      calc(var(--gallery-swipe-offset, 0px) + var(--gallery-parallax-x, 0px) + var(--gallery-transition-x, 0px)),
      calc(var(--gallery-parallax-y, 0px)),
      0
    )
    scale(var(--gallery-parallax-scale, 1));
}
.apple-configurator__image.app-gallery-layer.is-app-gallery-visible {
  opacity: 1;
  pointer-events: auto;
  z-index: 1;
}
.apple-configurator__image-wrap.is-pointer-active .apple-configurator__image.app-gallery-layer.is-app-gallery-visible {
  filter: saturate(1.02);
}
.apple-configurator__image-wrap.is-dragging .apple-configurator__image.app-gallery-layer {
  transition-duration: var(--motion-duration-instant);
}

.apple-configurator__image.is-image-transitioning,
.apple-configurator__image-wrap .product-image.is-image-transitioning {
  opacity: 0;
  --gallery-parallax-scale: 0.992;
  --gallery-transition-x: var(--gallery-exit-x, 0px);
}
.apple-configurator__image.is-image-entering,
.apple-configurator__image-wrap .product-image.is-image-entering {
  opacity: 0;
  --gallery-parallax-scale: 0.996;
  --gallery-transition-x: var(--gallery-enter-x, 0px);
}
.apple-configurator__gallery-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  min-height: 12px;
}
.gallery-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  border: none;
  padding: 0;
  background: rgba(29, 29, 31, 0.16);
  cursor: pointer;
  transition:
    transform var(--motion-duration-medium) var(--ease-out-apple),
    background-color var(--motion-duration-medium) var(--ease-out-apple);
}
.gallery-dot.is-active {
  background: #1d1d1f;
  transform: scale(1.4);
}
.gallery-dot--active {
  background: #1d1d1f;
  transform: scale(1.4);
}
.product-gallery-dots {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  z-index: 2;
}
.product-gallery-dots .gallery-dot {
  width: 6px;
  height: 6px;
}
.apple-configurator__image-placeholder {
  font-size: 14px;
  color: #86868b;
}
/* Без текста «Фото скоро»: ожидание первого кадра backend gallery (Watch и др.). */
.apple-configurator__image-placeholder--skeleton {
  width: 100%;
  min-height: 200px;
  border-radius: 12px;
  margin: 0 auto;
  max-width: 100%;
  box-sizing: border-box;
  font-size: 0;
  line-height: 0;
  color: transparent;
  background: var(--app-loading-shimmer-gradient);
  background-size: var(--app-loading-shimmer-size);
  animation: appLoadingShimmer var(--app-loading-shimmer-duration) ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  .apple-configurator__image-placeholder--skeleton {
    animation: none;
    background: #ececf1;
  }
}
/* Только первый кадр (ещё не было успешного resolve-configurator-gallery). Не использовать при refresh осей —
   иначе серый фон за изображением при стабильном предыдущем кадре. */
.apple-configurator__image-wrap--gallery-authority-pending {
  background: var(--app-loading-shimmer-gradient);
  background-size: var(--app-loading-shimmer-size);
  animation: appLoadingShimmer var(--app-loading-shimmer-duration) ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  .apple-configurator__image-wrap--gallery-authority-pending {
    animation: none;
    background: #f5f5f7;
  }
}
.apple-configurator__title {
  /* Размер/вес: app_typography.css */
  margin: 16px 0 0;
  text-align: center;
}
.config-summary {
  /* Слой secondary: app_typography.css */
  text-align: center;
  margin-top: 10px;
}
.apple-configurator__axes {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  margin-top: 8px;
}
.apple-configurator__compact-group {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  margin-top: 8px;
}
.apple-configurator__compact-group:empty {
  display: none;
  margin-top: 0;
}
.apple-configurator__axes-flow {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0 8px;
  width: 100%;
}
.apple-configurator__section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
  flex: 1 1 100%;
  min-width: 0;
  transition: opacity var(--motion-duration-medium, 180ms) var(--ease-out-apple, ease);
}
.apple-configurator__section--compact {
  flex: 0 0 auto;
  width: auto;
  max-width: 100%;
  gap: 0;
  margin-top: 0;
}
.apple-configurator__section--expanded {
  flex: 1 1 100%;
}
.apple-configurator__compact-pill {
  appearance: none;
  position: relative;
  border: 1.5px solid #0071e3;
  background: #f5f5f7;
  color: #1d1d1f;
  border-radius: 980px;
  padding: 8px 12px;
  min-height: 36px;
  max-width: min(100%, 220px);
  font-size: 12.5px;
  line-height: 1.25;
  font-weight: 500;
  cursor: pointer;
  box-sizing: border-box;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity var(--motion-duration-medium, 180ms) var(--ease-out-apple, ease),
    transform var(--motion-duration-medium, 180ms) var(--ease-out-apple, ease);
}
.apple-configurator__compact-pill::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: max(100%, 44px);
  height: 44px;
  transform: translate(-50%, -50%);
}
.apple-configurator__compact-pill:active {
  transform: scale(0.98);
}
@media (prefers-reduced-motion: reduce) {
  .apple-configurator__section,
  .apple-configurator__compact-pill {
    transition: none !important;
  }
  .apple-configurator__section--motion-fade {
    opacity: 1 !important;
  }
  .apple-configurator__compact-pill:active {
    transform: none;
  }
}
.apple-configurator__section .apple-configurator__label {
  margin-top: 0;
}
.apple-configurator__label {
  /* Слой label: app_typography.css */
  margin-top: 24px;
}
.apple-configurator__colors {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}
.apple-configurator__color {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}
.apple-configurator__color-swatch.color-option {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-sizing: border-box;
  background: transparent;
  padding: 0;
  border: 2px solid #ffffff;
  transition: border-color var(--motion-duration-medium) var(--ease-out-apple);
}
.apple-configurator__color-swatch.color-option:hover {
  transform: scale(1.05);
}
.apple-configurator__color-swatch.color-option.selected,
.apple-configurator__color-swatch.color-option.is-selected {
  border-color: #0a84ff;
}
.apple-configurator__color-swatch.color-option .inner-color {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}
.apple-configurator__options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.apple-configurator__option.storage-option {
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 14px;
  border: 2px solid transparent;
  background: #f5f5f7;
  color: #1d1d1f;
  cursor: pointer;
  transition:
    border-color var(--motion-duration-medium) var(--ease-out-apple),
    background-color var(--motion-duration-medium) var(--ease-out-apple),
    color var(--motion-duration-medium) var(--ease-out-apple);
}
.apple-configurator__option.storage-option:hover {
  border-color: #d1d1d6;
}
.apple-configurator__option.storage-option.is-selected {
  border-color: #0071e3;
  background: #fff;
  color: #0071e3;
}
.apple-configurator__options--storage {
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}
.apple-configurator__options--storage .apple-configurator__option.storage-option {
  padding: 5px 10px;
  font-size: 13px;
  flex-shrink: 0;
}
.apple-configurator__options--tile-grid {
  display: grid;
  grid-template-columns: repeat(var(--axis-tile-columns, 2), minmax(0, 1fr));
  gap: 0;
  border: 1px solid #d2d2d7;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}
.apple-configurator__options--tile-grid .apple-configurator__option.storage-option {
  position: relative;
  margin: 0;
  border: none;
  border-radius: 0;
  border-right: 1px solid #d2d2d7;
  border-bottom: 1px solid #d2d2d7;
  min-height: 48px;
  padding: 12px 8px;
  font-size: 15px;
  font-weight: 500;
  justify-content: center;
  text-align: center;
  background: #fff;
}
.apple-configurator__options--tile-grid .apple-configurator__option.storage-option:nth-child(2n) {
  border-right: none;
}
.apple-configurator__options--tile-grid .apple-configurator__option.storage-option:nth-last-child(-n + 2) {
  border-bottom: none;
}
.apple-configurator__options--tile-grid .apple-configurator__option.storage-option.is-selected {
  background: rgba(0, 113, 227, 0.08);
  color: #0071e3;
  border-color: #d2d2d7;
}
.apple-configurator__options--tile-grid .apple-configurator__option.storage-option.is-selected::after,
.apple-configurator__options--tile-grid .apple-configurator__option.storage-option:focus-visible::after {
  content: "";
  position: absolute;
  inset: 2px;
  border: 1.5px solid #0071e3;
  border-radius: 8px;
  pointer-events: none;
}
.apple-configurator__options--tile-grid .apple-configurator__option.storage-option:focus {
  outline: none;
}
.apple-configurator__options--tile-grid .apple-configurator__option.storage-option:focus-visible:not(.is-selected) {
  background: #f5f5f7;
}
.apple-configurator__options--tile-grid .apple-configurator__option.storage-option:hover {
  border-color: #d2d2d7;
  background: #f5f5f7;
}
.apple-configurator__options--tile-grid .apple-configurator__option.storage-option.is-selected:hover {
  background: rgba(0, 113, 227, 0.1);
}
.apple-configurator__price-wrap {
  margin-top: 16px;
}
.apple-configurator__price-wrap .price-label {
  /* Размер/цвет: app_typography.css */
  margin-top: 0;
}
.apple-configurator__price-wrap .price-value {
  font-size: 28px;
  font-weight: 700;
  color: #000;
  margin-top: 4px;
  transition: opacity 140ms var(--ease-out-apple);
}
.apple-configurator__price-wrap--partial .price-value {
  opacity: 0.88;
}
.apple-configurator__price-wrap--resolved .price-value {
  opacity: 1;
}
@keyframes appPolishOptionFlash {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  40% {
    transform: scale(0.96);
    opacity: 0.9;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}
.apple-configurator__option.storage-option.app-polish--option-flash,
.apple-configurator__color-swatch.app-polish--option-flash {
  animation: appPolishOptionFlash 120ms var(--ease-out-apple) both;
}
.apple-configurator .button-add-to-cart {
  width: 100%;
  height: 52px;
  border-radius: 26px;
  font-size: 16px;
  font-weight: 600;
  background: #0071e3;
  color: #fff;
  margin-top: 24px;
  border: none;
  cursor: pointer;
  transition:
    background-color var(--motion-duration-medium) var(--ease-out-apple),
    color var(--motion-duration-medium) var(--ease-out-apple),
    opacity var(--motion-duration-medium) var(--ease-out-apple);
}
.apple-configurator .button-add-to-cart:disabled {
  background: #d1d1d6;
  color: #8e8e93;
  cursor: default;
}
/* iPad: первый resolve-variant — фиксированная высота блока цены/CTA, без скачка layout. */
.apple-configurator__price-wrap--initial-loading .price-value {
  min-height: 1.25em;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: #6e6e73;
}
.apple-configurator__add-btn--initial-loading.button-add-to-cart {
  min-height: 52px;
  box-sizing: border-box;
}

/* Product-view overlay: тот же configurator, контекст product-view вместо content-screen. */
.apple-configurator--product-overlay {
  padding: 8px 0 calc(16px + env(safe-area-inset-bottom, 0px));
}
.apple-configurator--product-overlay .apple-configurator__card.product-card {
  box-shadow: none;
}
.product-card__content-zone--overlay {
  margin-top: 12px;
  padding: 0 14px 8px;
}
