/* Shared by the catalogue and home carousel. */
.store-product-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 0;
  border-radius: 16px;
  background: var(--card-bg);
  box-shadow: 0 2px 5px #0000000a;
}

.store-product-card:hover { box-shadow: 0 4px 12px #00000012; }

.store-card__media {
  position: relative;
  display: block;
  flex: none;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--photo-bg);
  color: var(--ip-text-muted);
  text-decoration: none;
}

:root[data-theme="dark"] .store-card__media { background: var(--ip-bg); }

.store-card__placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 16px;
}

.store-card__placeholder > span {
  font-size: clamp(18px, 2.2vw, 30px);
  font-weight: 600;
  letter-spacing: -.055em;
  white-space: nowrap;
}

.store-card__media .product-image-frame { inset: 24px 16px; }
.store-card__media .product-photo-caption { bottom: 4px; font-size: 10px; line-height: 14px; }

.store-card__badge {
  position: absolute;
  top: 8px;
  right: 8px;
  max-width: calc(100% - 16px);
  padding: 4px 8px;
  border: 1px solid var(--ip-border);
  border-radius: 999px;
  color: var(--ip-accent);
  background: var(--card-bg);
  font-size: 11px;
  line-height: 14px;
  font-weight: 600;
}

.store-card__badge--out { color: var(--ip-text-muted); }

.store-product-card .product-card__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px;
  text-align: left;
}

.store-product-card .product-card__name {
  margin: 0;
  min-height: 2.5em;
  font-size: 16px;
  line-height: 1.25;
  letter-spacing: -.015em;
  overflow-wrap: anywhere;
}

.store-product-card .product-card__name a { text-decoration: none; }

.store-product-card .product-card__price {
  margin: 0;
  padding: 0;
  font-size: clamp(17px, 1.9vw, 23px);
  line-height: 1.2;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.store-product-card .product-card__price .price-usd {
  margin-top: 4px;
  color: var(--ip-text-muted);
  font-size: 13px;
  line-height: 18px;
  font-weight: 500;
}

.store-card__actions {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  align-items: stretch;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--ip-border);
}

.store-card__actions .btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 6px 8px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  text-align: center;
  white-space: normal;
}

.store-card__actions .btn--primary {
  background: var(--action-bg);
  border: 1px solid transparent;
  color: var(--action-text);
}

.store-card__actions .btn--primary:hover:not(:disabled) { filter: brightness(.92); }

.store-card__actions .btn .icon {
  display: block;
  width: 16px;
  height: 16px;
  flex: none;
}

.store-card__actions .store-card__details {
  background: transparent;
  color: var(--ip-text);
  border: 1px solid var(--ip-border);
}

.store-card__actions .store-card__details:hover { background: var(--ip-surface); }

.store-card__actions .btn:focus-visible {
  outline: 2px solid var(--action-bg);
  outline-offset: 2px;
}

.store-card__actions .btn:hover { transform: none; }

.store-card__media:focus-visible { outline-offset: -3px; }

.grid-products--catalog {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

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

@media (max-width: 639px) {
  .grid-products--catalog {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .grid-products--catalog .store-product-card { border-radius: 12px; }
  .grid-products--catalog .product-card__body { padding: 8px; }
  .grid-products--catalog .product-card__name { font-size: 14px; }
  .grid-products--catalog .store-card__badge { font-size: 10px; }
  .grid-products--catalog .store-card__media .product-image-frame { inset: 24px 12px 16px; }
}

@media (max-width: 639px) {
  .store-card__actions { grid-template-columns: minmax(0, 1fr); }
}

.catalog.catalog--simple { display: block; grid-template-columns: none; }
.catalog--simple > .grid-products { width: 100%; }

/* Illustrations share a sheet. Each product displays one square tile. */
.product-image-frame--illustrated { container-type: size; }

.catalog-illustration {
  display: block;
  width: min(100cqw, 100cqh);
  aspect-ratio: 1;
  background-repeat: no-repeat;
  background-size: 400% 400%;
  border-radius: 8px;
}

.catalog-illustration--1 { background-image: url("../img/catalogo-ilustraciones-1.jpg"); }
.catalog-illustration--2 { background-image: url("../img/catalogo-ilustraciones-2.jpg"); }

.product-detail__media .catalog-illustration { width: min(100cqw, 100cqh, 300px); }

.detail-palette { margin:16px 0; }
.detail-palette p { font-weight:600; margin:0 0 8px; }
.detail-palette ul { display:flex; flex-wrap:wrap; gap:8px; list-style:none; padding:0; margin:0; }
.detail-palette li { display:inline-flex; align-items:center; gap:7px; border:1px solid var(--ip-border); border-radius:999px; padding:5px 11px; }
.detail-swatch { display:inline-block; width:16px; height:16px; flex:0 0 16px; border:1px solid #7b7b7b; border-radius:50%; background:var(--swatch); }

.store-product-card--iphone .product-card__name { min-height:0; }
.accessory-description { margin:16px 0; padding:16px; border:1px solid var(--ip-border); border-radius:12px; }
.accessory-description h2 { margin:0 0 8px; font-size:1.1rem; line-height:1.35; }
.accessory-description > p { margin:0 0 10px; }
.accessory-description > :last-child { margin-bottom:0; }
.accessory-origin { display:flex; gap:8px; flex-wrap:wrap; }
.accessory-origin span { color:var(--ip-text-muted); }
.accessory-description .detail-palette { margin-top:10px; }

/* Catalogue spacing, adapted from the measured two- and three-column reference. */
.container.catalog-page { max-width:1280px; padding-inline:12px; }
.catalog-page .catalog__top { align-items:baseline; margin-top:24px; }
.catalog-page .catalog__top h1 { font-size:22px; line-height:1.2; }
.catalog-page .catalog-tools { margin:16px 0; }
.catalog-page .catalog-tools label { gap:6px; }
.catalog-page .catalog-tools input { height:48px; min-height:48px; border-radius:16px; padding:8px 12px; }
.catalog-page .grid-products--catalog { gap:12px; }
.catalog-page .store-product-card { border-radius:16px; }
.catalog-page .store-card__media .product-image-frame { inset:24px clamp(12px, 2.1vw, 32px) 16px; }
.catalog-page .store-product-card .product-card__body { align-items:stretch; gap:8px; padding:12px; }
.catalog-page .store-product-card .product-card__name { font-size:14px; line-height:1.5; }
.catalog-page .store-card__actions { gap:6px; padding:8px; }
.catalog-page .store-card__actions .btn { min-height:44px; }
@media (min-width:640px) {
  .catalog-page .grid-products--catalog { gap:16px; }
}
@media (min-width:1024px) {
  .catalog-page .catalog__top { margin-top:32px; }
  .catalog-page .catalog__top h1 { font-size:28px; }
  .catalog-page .catalog-tools { margin:20px 0 24px; }
  .catalog-page .catalog-search { flex:0 1 483px; }
  .catalog-page .grid-products--catalog { grid-template-columns:repeat(3,minmax(0,1fr)); gap:24px; }
  .catalog-page .store-product-card .product-card__body { padding:12px 16px; }
  .catalog-page .store-product-card .product-card__name { font-size:16px; }
  .catalog-page .store-card__actions { gap:8px; padding:8px 12px; }
}

.store-card__actions .btn span { min-width:0; }
.store-card__actions .btn:disabled,.product-detail .btn:disabled { opacity:.55; cursor:not-allowed; }

.product-gallery { min-width:0; }
.product-gallery__track { display:flex; overflow-x:auto; scroll-snap-type:x mandatory; overscroll-behavior-x:contain; scrollbar-width:none; border-radius:var(--radius); }
.product-gallery__track::-webkit-scrollbar { display:none; }
.product-gallery__slide { flex:0 0 100%; min-width:0; scroll-snap-align:start; }
.product-gallery__controls { display:flex; align-items:center; justify-content:center; gap:14px; margin-top:12px; }
.product-gallery__controls .btn { width:44px; min-height:44px; padding:0; font-size:24px; }
.product-gallery__controls .btn:disabled { opacity:.5; }
.product-gallery__count { min-width:44px; text-align:center; color:var(--ip-text-muted); font-variant-numeric:tabular-nums; }

.product-detail__media { aspect-ratio:1; align-self:start; }
.phone-detail-media .product-image-frame { inset:clamp(12px, 4%, 24px); }
.accessory-description > p { white-space:pre-wrap; overflow-wrap:anywhere; }
.product-gallery__controls .btn { display:grid; place-items:center; line-height:1; }

/* Use the whole media area while preserving the photo's proportions. */
.store-card__media .product-image-frame,
.grid-products--catalog .store-card__media .product-image-frame,
.catalog-page .store-card__media .product-image-frame,
.product-detail__media .product-image-frame,
.phone-detail-media .product-image-frame { inset:0; }
.product-image-frame > img { object-fit:contain; object-position:center; }
.product-image-frame > .product-reference-photo { border-radius:0; }

.store-card-photos,
.store-card-photos__slide {
  position: absolute;
  inset: 0;
}

.store-card-photos__slide {
  opacity: 0;
  transition: opacity 220ms ease;
  background: var(--photo-bg);
}

:root[data-theme="dark"] .store-card-photos__slide { background: var(--ip-bg); }
.store-card-photos__slide.is-current { opacity: 1; z-index: 1; }
.store-card-photos__slide.is-next { z-index: 2; }
.store-card__badge { z-index: 3; }

.store-card__media .product-image-frame--uploaded > img,
.product-detail__media .product-image-frame--uploaded > img {
  object-fit: cover;
  object-position: center;
}

@media (hover: hover) {
  .store-card__media:hover .store-card-photos__slide.is-next { opacity: 1; }
}

.store-card__media:focus-visible .store-card-photos__slide.is-next { opacity: 1; }
.store-card__media:focus-visible { z-index: 1; }

@media (prefers-reduced-motion: reduce) {
  .store-card-photos__slide { transition: none; }
}
