/* Fotos de producto del catálogo — SIEMPRE completas (sin recortar), con marco parejo.
   Lo que sobra alrededor se rellena con la propia foto desenfocada (--ph), así ninguna foto se ve con barras vacías.
   Cargado después de catalog-refine y catalog-motion; usa los tokens de cada apariencia. */
:root { --img-ar: 1 / 1; }

/* ---------- Marco ---------- */
body .prod-img-wrap, body .oferta-img-wrap {
  position: relative;
  aspect-ratio: var(--img-ar);
  overflow: hidden;
  isolation: isolate;
  background: color-mix(in srgb, var(--text) 5%, var(--bg-card));
}
body .oferta-img-wrap { aspect-ratio: 4 / 3; }

/* Fondo: la misma foto, desenfocada y suave. Mientras carga, brillo de esqueleto. */
body .prod-img-wrap::before, body .oferta-img-wrap::before {
  content: ""; position: absolute; inset: -14%; z-index: 0; pointer-events: none;
  background: var(--ph, none) center / cover no-repeat;
  filter: blur(22px) saturate(1.15);
  opacity: .85;
}
body .prod-img-wrap:not([style*="--ph"])::before, body .oferta-img-wrap:not([style*="--ph"])::before {
  inset: 0; filter: none; opacity: 1;
  background: linear-gradient(100deg, transparent 30%, color-mix(in srgb, var(--text) 7%, transparent) 50%, transparent 70%) 0 0 / 220% 100% no-repeat;
  animation: mediaShimmer 1.5s linear infinite;
}
body .prod-img-wrap:has(> img.img-loaded):not([style*="--ph"])::before, body .oferta-img-wrap:has(> img.img-loaded):not([style*="--ph"])::before { animation: none; background: none; }
@keyframes mediaShimmer { from { background-position: 120% 0; } to { background-position: -100% 0; } }

/* Foto completa: contain, centrada */
body .prod-img-wrap > img, body .oferta-img-wrap > img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  aspect-ratio: auto;
  object-fit: contain;
  background: transparent !important;
  object-position: center;
  z-index: 1;
}
/* Filo interior: separa el marco del fondo de la tarjeta */
body .prod-img-wrap::after, body .oferta-img-wrap::after {
  content: ""; position: absolute; inset: 0; z-index: 3; pointer-events: none;
  background: none !important; opacity: 1 !important;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text) 8%, transparent);
  border-radius: inherit;
}

/* ---------- Segunda foto y contador ---------- */
body .prod-card .prod-img-alt { opacity: 0 !important; transition: opacity .55s cubic-bezier(.22, 1, .36, 1), transform .9s cubic-bezier(.22, 1, .36, 1) !important; pointer-events: none; z-index: 2; background: color-mix(in srgb, var(--text) 5%, var(--bg-card)); }
.prod-photos {
  position: absolute; right: 9px; bottom: 9px; z-index: 4;
  display: inline-flex; align-items: center; gap: 4px;
  min-height: 24px; padding: 0 9px; border-radius: 999px;
  background: color-mix(in srgb, #0d0d0d 62%, transparent); color: #fff;
  font: 700 11px var(--font-body, Inter, system-ui, sans-serif); letter-spacing: .02em;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  transition: opacity .3s;
}
@media (hover: hover) {
  body .prod-card:hover .prod-img-alt[data-i="1"] { opacity: 1 !important; }
}

body .prod-card .prod-img-alt.is-on { opacity: 1 !important; }
.prod-dots {
  position: absolute; left: 50%; bottom: 9px; transform: translateX(-50%); z-index: 4;
  display: inline-flex; align-items: center; gap: 5px; padding: 6px 9px; border-radius: 999px;
  background: color-mix(in srgb, #0d0d0d 46%, transparent);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); pointer-events: none;
}
.prod-dots i { width: 6px; height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .55); transition: width .3s cubic-bezier(.22, 1, .36, 1), background .3s; }
.prod-dots i.on { width: 16px; background: #fff; }

/* Insignias sobre la foto: siempre por encima del marco */
body .prod-badge-wrap { z-index: 4; }

/* Foto de reemplazo ("sin imagen"): tenue y con aire */
body .prod-img-wrap > img[src$="sin-imagen.svg"], body .oferta-img-wrap > img[src$="sin-imagen.svg"] { padding: 14%; opacity: .55; }

/* ---------- Ficha del producto ---------- */
.prod-stage { position: relative; isolation: isolate; background: color-mix(in srgb, var(--text) 5%, var(--bg-card)); }
.prod-stage::before {
  content: ""; position: absolute; inset: -14%; z-index: 0; pointer-events: none;
  background: var(--ph, none) center / cover no-repeat; filter: blur(26px) saturate(1.15); opacity: .55;
}
.prod-main-img { position: relative; z-index: 1; object-fit: contain !important; object-position: center; aspect-ratio: 1 / 1 !important; }
.prod-thumb { object-fit: contain; background: color-mix(in srgb, var(--text) 5%, var(--bg-card)); }
.prod-zoom, .prod-badge { z-index: 4; }
.related-img { object-fit: contain !important; background: color-mix(in srgb, var(--text) 5%, var(--bg-card)); }

@media (prefers-reduced-motion: reduce) {
  body .prod-img-wrap::before, body .oferta-img-wrap::before { animation: none; }
  .prod-img-alt { transition: none !important; }
}

/* ---------- Modelos / Lookbook: composición editorial ---------- */
.xs-mod {
  --mod-bg: color-mix(in srgb, var(--text) 95%, var(--bg));
  --mod-fg: var(--bg);
  position: relative; overflow: hidden; isolation: isolate;
  padding: clamp(56px, 9vw, 120px) 0 clamp(48px, 8vw, 100px);
  background: var(--mod-bg); color: var(--mod-fg);
}
/* Resplandores de color del acento detrás de las fotos */
.xs-mod::before, .xs-mod::after { content: ""; position: absolute; z-index: -1; border-radius: 50%; filter: blur(90px); opacity: .32; pointer-events: none; }
.xs-mod::before { width: 46vw; height: 46vw; left: -14vw; top: -12vw; background: var(--accent); }
.xs-mod::after { width: 38vw; height: 38vw; right: -10vw; bottom: -12vw; background: var(--accent-glow, var(--accent)); }
.mod-in { max-width: 1240px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px); }

.mod-head { text-align: center; max-width: 780px; margin: 0 auto clamp(30px, 6vw, 68px); }
.mod-eyebrow { display: inline-flex; align-items: center; gap: 14px; font: 700 .74rem/1 var(--font-body, Inter, system-ui, sans-serif); letter-spacing: .34em; text-transform: uppercase; color: color-mix(in srgb, var(--mod-fg) 78%, transparent); }
.mod-eyebrow::before, .mod-eyebrow::after { content: ""; width: 34px; height: 1px; background: currentColor; opacity: .6; }
.mod-title { margin: 16px 0 0; font-family: var(--font-heading); font-weight: 700; font-size: clamp(2.5rem, 8.4vw, 5.6rem); line-height: 1.02; letter-spacing: -.02em; color: var(--mod-fg); text-wrap: balance; }
.mod-sub { margin: 18px auto 0; max-width: 52ch; font-size: clamp(1rem, 2.3vw, 1.2rem); line-height: 1.6; color: color-mix(in srgb, var(--mod-fg) 72%, transparent); }
.mod-line { display: block; width: 64px; height: 3px; margin: 26px auto 0; border-radius: 3px; background: linear-gradient(90deg, var(--accent), var(--accent-glow, var(--accent))); }

/* Fotos */
.xs-models { display: grid; gap: clamp(12px, 2vw, 22px); align-items: start; }
.xs-model {
  position: relative; margin: 0; aspect-ratio: 3 / 4; overflow: hidden; isolation: isolate; cursor: zoom-in;
  border-radius: min(var(--radius, 16px), 28px);
  background: color-mix(in srgb, var(--mod-fg) 8%, var(--mod-bg));
  box-shadow: 0 24px 60px -28px rgba(0, 0, 0, .7);
  outline: 1px solid color-mix(in srgb, var(--mod-fg) 0%, transparent); outline-offset: 5px;
  transition: outline-color .4s, outline-offset .5s cubic-bezier(.22, 1, .36, 1), box-shadow .5s;
}
.xs-model::before {
  content: ""; position: absolute; inset: -14%; z-index: 0; pointer-events: none;
  background: var(--ph, none) center / cover no-repeat; filter: blur(26px) saturate(1.2); opacity: .9;
}
.xs-model > img { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; object-fit: cover; object-position: 50% 22%; background: transparent !important; transition: transform 1.1s cubic-bezier(.22, 1, .36, 1), filter .6s; }
.xs-model::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 55%; z-index: 2; pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(8, 8, 10, .74));
  opacity: .9; transition: opacity .5s;
}
.mod-idx {
  position: absolute; z-index: 3; top: 14px; left: 14px;
  display: inline-flex; align-items: center; justify-content: center; min-width: 38px; height: 26px; padding: 0 10px; border-radius: 999px;
  font: 700 11px/1 var(--font-body, Inter, system-ui, sans-serif); letter-spacing: .14em; color: #fff;
  background: rgba(10, 10, 12, .38); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, .28);
}
.xs-model figcaption { position: absolute; z-index: 3; left: 0; right: 0; bottom: 0; padding: 0 18px 18px; color: #fff; }
.xs-model figcaption span {
  display: block; font-family: var(--font-heading); font-weight: 600; font-size: clamp(1.05rem, 2.2vw, 1.35rem); line-height: 1.2;
  text-shadow: 0 2px 14px rgba(0, 0, 0, .55);
  transition: transform .6s cubic-bezier(.22, 1, .36, 1);
}
.xs-model figcaption span::before { content: ""; display: block; width: 26px; height: 2px; margin-bottom: 10px; background: var(--accent-glow, #fff); transition: width .6s cubic-bezier(.22, 1, .36, 1); }
@media (hover: hover) {
  .xs-model:hover { outline-color: color-mix(in srgb, var(--accent-glow, var(--accent)) 80%, transparent); outline-offset: 9px; box-shadow: 0 34px 70px -26px rgba(0, 0, 0, .8); }
  .xs-model:hover > img { transform: scale(1.07); }
  .xs-model:hover figcaption span { transform: translateY(-4px); }
  .xs-model:hover figcaption span::before { width: 54px; }
}

/* Escritorio: mosaico asimétrico */
@media (min-width: 720px) {
  .xs-models.mod-n1 { grid-template-columns: minmax(0, 480px); justify-content: center; }
  .xs-models.mod-n2 { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 860px; margin-inline: auto; }
  .xs-models.mod-n2 .xs-model:nth-child(2) { margin-top: clamp(30px, 6vw, 80px); }
  .xs-models.mod-n3 { grid-template-columns: 1.25fr 1fr; grid-auto-flow: dense; }
  .xs-models.mod-n3 .xs-model:first-child { grid-row: span 2; aspect-ratio: auto; height: 100%; min-height: 0; }
  .xs-models.mod-n4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .xs-models.mod-n4 .xs-model:nth-child(even) { margin-top: clamp(28px, 5vw, 72px); }
  .xs-models.mod-n5 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .xs-models.mod-n5 .xs-model:first-child { grid-column: span 2; grid-row: span 2; aspect-ratio: auto; height: 100%; }
  .xs-models.mod-n6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .xs-models.mod-n6 .xs-model:nth-child(3n + 2) { margin-top: clamp(28px, 5vw, 72px); }
  .xs-models.mod-n7, .xs-models.mod-n8, .xs-models.mod-n9, .xs-models.mod-n10, .xs-models.mod-n11, .xs-models.mod-n12 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .xs-models.mod-n7 .xs-model:nth-child(4n + 2), .xs-models.mod-n8 .xs-model:nth-child(4n + 2), .xs-models.mod-n9 .xs-model:nth-child(4n + 2), .xs-models.mod-n10 .xs-model:nth-child(4n + 2), .xs-models.mod-n11 .xs-model:nth-child(4n + 2), .xs-models.mod-n12 .xs-model:nth-child(4n + 2),
  .xs-models.mod-n7 .xs-model:nth-child(4n), .xs-models.mod-n8 .xs-model:nth-child(4n), .xs-models.mod-n9 .xs-model:nth-child(4n), .xs-models.mod-n10 .xs-model:nth-child(4n), .xs-models.mod-n11 .xs-model:nth-child(4n), .xs-models.mod-n12 .xs-model:nth-child(4n) { margin-top: clamp(24px, 4vw, 56px); }
  .mod-dots { display: none !important; }
}

/* Celular: carrusel con foto asomando */
@media (max-width: 719px) {
  .xs-models {
    display: flex; gap: 12px; overflow-x: auto; overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; scrollbar-width: none;
    margin: 0 calc(-1 * clamp(16px, 4vw, 40px)); padding: 6px clamp(16px, 4vw, 40px) 22px;
    scroll-padding-inline: clamp(16px, 4vw, 40px);
  }
  .xs-models::-webkit-scrollbar { display: none; }
  .xs-model { flex: 0 0 78%; scroll-snap-align: center; }
  .xs-models.mod-n1 .xs-model { flex-basis: 100%; }
  .xs-model:active { transform: scale(.985); }
}
.mod-dots { display: flex; justify-content: center; gap: 7px; margin-top: 4px; }
.mod-dots i { width: 7px; height: 7px; border-radius: 99px; background: color-mix(in srgb, var(--mod-fg) 30%, transparent); transition: width .35s cubic-bezier(.22, 1, .36, 1), background .3s; }
.mod-dots i.on { width: 26px; background: var(--accent-glow, var(--accent)); }

@media (prefers-reduced-motion: reduce) { .xs-model, .xs-model > img, .xs-model figcaption span { transition: none; } }

/* ---------- Recién llegados / Más vendidos: usan la misma tarjeta que los productos ---------- */
.xs-strip .ofertas-track .prod-card { flex: 0 0 clamp(216px, 68vw, 276px); min-width: 0; }
.prod-badge-new, .prod-badge-rank {
  display: inline-block; font-size: 10px; font-weight: 800; padding: 3px 10px; border-radius: 6px;
  text-transform: uppercase; letter-spacing: .05em; line-height: 1.4;
}
.prod-badge-new { background: var(--accent); color: var(--soc-on-accent, #fff); }
.prod-badge-rank { background: var(--accent-glow, #c9a86c); color: #16130f; }
body .prod-badge-wrap { align-items: flex-start; }
.prod-badge-rank { background: linear-gradient(135deg, #f6d36b, #e0a92e); color: #1a1200; box-shadow: 0 2px 10px rgba(224, 169, 46, .35); }

/* ---------- Etiquetas personalizadas del producto (texto + color propios) ---------- */
.prod-tag-custom {
  display: inline-block; max-width: 100%; font-size: 10px; font-weight: 800; line-height: 1.4; padding: 3px 10px; border-radius: 6px;
  text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
}
.prod-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.prod-tags .prod-tag-custom { font-size: 11px; padding: 5px 12px; border-radius: 999px; }

/* Etiquetas personalizadas: debajo de la foto, para que nunca la tapen */
.prod-tags-row { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.prod-tags-row .prod-tag-custom { box-shadow: none; font-size: 10px; padding: 3px 9px; }
body .prod-badge-wrap { max-width: 78%; }
/* Con el panel de filtros abierto, los botones flotantes no tapan el botón "Buscar" */
body:has(.filter-sidebar.sidebar-open) #chat-fab, body:has(.filter-sidebar.sidebar-open) .filter-fab { opacity: 0; pointer-events: none; }

/* ---------- Accesibilidad y ritmo ---------- */
.skip-link { position: fixed; left: 12px; top: -60px; z-index: 100000; padding: 12px 18px; border-radius: 12px; background: var(--accent); color: var(--soc-on-accent, #fff); font-weight: 700; text-decoration: none; transition: top .2s; }
.skip-link:focus { top: 12px; }
:where(a, button, input, select, textarea, [tabindex]):focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
#contenido:focus { outline: none; }
h1.hero-name, h1.hdr-title { margin: 0; }
.prod-name a { color: inherit; text-decoration: none; display: block; }
.prod-name a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Objetivos táctiles de 44 px */
html body .hdr .wa-pill, html body .hdr .admin-pill, html body .install-pill { min-height: 44px; display: inline-flex; align-items: center; }
html body .prod-actions .prod-btn, html body .prod-actions .prod-view-btn, html body .oferta-actions .prod-btn, html body .oferta-actions .prod-view-btn { min-height: 44px; }
html body .prod-actions .prod-share-btn, html body .oferta-actions .prod-share-btn { min-width: 44px; height: 44px; }
html body .filter-cat, html body .filter-group-btn, html body .filter-clear { min-height: 44px; }
html body .filter-range, html body .filter-attr { min-height: 44px; }
html body .ofertas-arrow { min-width: 44px; min-height: 44px; }

/* Cabecera fija: mientras se ve la portada no repite logo y nombre (solo acciones); aparecen al bajar */
body:has(.hero, .brand-hero) .hdr:not(.hdr-compact) .hdr-left { opacity: 0; pointer-events: none; }
.hdr .hdr-left { transition: opacity .3s ease; }

/* Rendimiento y ritmo: lo que queda fuera de pantalla se pinta al acercarse */
.xs-sec, .xs-mod, .ftr, .xs-strip { content-visibility: auto; contain-intrinsic-size: auto 560px; }
/* Franjas seguidas (Ofertas, Recién llegados, Más vendidos): la alternancia de fondo las separa y da ritmo */
.ofertas-section + .ofertas-section { background: color-mix(in srgb, var(--accent) 5%, var(--bg)); padding-block: clamp(14px, 3vw, 28px); margin-top: clamp(10px, 2vw, 20px); }
.ofertas-section + .ofertas-section + .ofertas-section { background: transparent; }
html body .hdr-left { min-width: 0; flex: 1 1 auto; }
html body .hdr-logo { flex: none; }
html body .hdr-right { flex: none; }

/* Atributos informativos del producto (Medida, Color...) */
.prod-specs { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.prod-spec { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--border, rgba(0,0,0,.14)); background: color-mix(in srgb, var(--accent) 7%, var(--bg-card, #fff)); color: var(--text-secondary); font-size: 11.5px; font-weight: 600; line-height: 1.5; white-space: nowrap; }
