/* HoraWeb Loja — Cards 590 x 300, revisão 2026-11-11
 * Escopo: vitrine, carrossel, busca, categorias, filtros, página do produto.
 * Sem alterações de banco, URLs ou comportamento do checkout.
 */

/* A capa recebe a largura que merece. Três por linha em vez de quatro. */
body .grid {grid-template-columns:repeat(var(--hw-cols,3),minmax(0,1fr));gap:22px}
body .hw-carousel-slide {flex:0 0 calc((100% - (var(--hw-cols,3) - 1)*22px)/var(--hw-cols,3))}
body .hw-carousel-track {gap:22px}

/* Layout compacto com prioridade visual à capa original, sem cortes nem zoom. */
body .hw-product-card {
  min-width:0;
  border:1px solid var(--ln);
  border-radius:12px;
  overflow:hidden;
  box-shadow:0 2px 12px rgba(12,27,46,.055);
  transition:transform .18s ease,border-color .18s ease,box-shadow .18s ease;
}
body .hw-product-card:hover {
  transform:translateY(-3px);
  border-color:var(--g);
  box-shadow:0 12px 30px rgba(12,27,46,.13);
}
/* 590x300 é a proporção exata: nenhuma borda da imagem se perde. */
body .hw-product-card > a.th {
  display:flex;
  width:100%;
  height:auto;
  aspect-ratio:590 / 300;
  min-height:0;
  overflow:hidden;
  align-items:center;
  justify-content:center;
  padding:0;
  background:var(--sf);
  border-bottom:1px solid var(--ln);
  color:var(--gd);
}
body .hw-product-card > a.th > img {
  display:block;
  position:static;
  inset:auto;
  width:100%;
  height:100%;
  max-width:100%;
  max-height:100%;
  object-fit:contain;
  object-position:center;
  transform:none;
  filter:none;
  border-radius:0;
  background:var(--sf);
}
body .hw-product-card:hover > a.th > img {transform:none}
body .hw-product-card .bd {top:9px;left:9px;border:1px solid rgba(0,0,0,.07)}
body .hw-product-card .cb {padding:13px 16px 15px;gap:3px}
body .hw-product-card .cb h3 {
  margin:0;
  font-size:15px;
  font-weight:750;
  line-height:1.4;
  display:-webkit-box;
  -webkit-box-orient:vertical;
  -webkit-line-clamp:2;
  overflow:hidden;
  min-height:2.8em;
}
body .hw-product-card .by {margin-top:3px;font-size:12px}
body .hw-product-card .hw-card-metrics {margin:8px 0 5px;padding-top:8px;gap:5px 10px}
body .hw-product-card .hw-card-summary {
  font-size:12px!important;
  line-height:1.45!important;
  display:-webkit-box;
  -webkit-box-orient:vertical;
  -webkit-line-clamp:2;
  overflow:hidden;
  margin:5px 0!important;
}
body .hw-product-card .pr {font-size:19px;padding:6px 0;margin-top:auto}
body .hw-product-card .hw-card-actions {margin-top:auto;gap:6px}
body .hw-product-card .hw-card-actions .btn {min-height:40px}

/* Página individual: capa na proporção nativa e galeria com miniaturas legíveis. */
body .pd-main .product-gallery {
  width:100%;
  aspect-ratio:590 / 300;
  overflow:hidden;
  background:var(--sf);
  border:1px solid var(--ln);
  border-radius:12px;
  display:flex;
  justify-content:center;
  align-items:center;
}
body .pd-main .product-gallery > img,
body .pd-main .product-gallery > #mainProductImage {
  display:block;
  width:100%;
  height:100%;
  aspect-ratio:590 / 300;
  object-fit:contain;
  object-position:center;
  background:var(--sf);
}
body .pd-main .gallery-thumbs {display:flex;gap:10px;flex-wrap:wrap;padding:12px 0}
body .pd-main .gallery-thumbs button {
  width:116px;
  height:auto;
  aspect-ratio:590 / 300;
  padding:2px;
  border-radius:8px;
  background:var(--sf);
}
body .pd-main .gallery-thumbs button img {
  width:100%;height:100%;object-fit:contain;background:var(--sf);
}
body .pd-main .gallery-thumbs button.is-active {border-color:var(--g)}

/* 768–1100 px: manter as imagens grandes sem apertar os textos. */
@media(max-width:1100px){
  body .grid {grid-template-columns:repeat(var(--hw-cols-tablet,2),minmax(0,1fr));gap:18px}
  body .hw-carousel-slide {flex-basis:calc((100% - (var(--hw-cols-tablet,2) - 1)*18px)/var(--hw-cols-tablet,2))}
  body .hw-carousel-track {gap:18px}
}
/* Celular: uma capa inteira ocupando toda a largura útil. */
@media(max-width:620px){
  body .grid {grid-template-columns:repeat(var(--hw-cols-mobile,1),minmax(0,1fr));gap:16px}
  body .hw-carousel-slide {flex-basis:calc((100% - (var(--hw-cols-mobile,1) - 1)*14px)/var(--hw-cols-mobile,1))}
  body .hw-carousel-track {gap:14px}
  body .hw-product-card .cb {padding:13px 14px 15px}
  body .hw-product-card .cb h3 {font-size:15px}
  body .pd-main .gallery-thumbs button {width:99px}
}
@media(prefers-reduced-motion:reduce){body .hw-product-card{transition:none}}

/* V2 - Cards da mesma linha SEMPRE alinhados, mesmo com títulos e métricas diferentes. */
body .grid {align-items:stretch;grid-auto-flow:row;grid-auto-rows:1fr;}
body .hw-carousel-track {align-items:stretch;}
body .hw-carousel-slide {align-self:stretch;display:flex;}
body .hw-product-card {height:100%;width:100%;display:flex!important;flex-direction:column;box-sizing:border-box;}
body .hw-product-card .cb {display:flex;flex-direction:column;flex:1;min-height:0;}
body .hw-product-card .cb > a:first-of-type {display:block;}
body .hw-product-card .cb h3 {min-height:2.8em;max-height:2.8em;overflow:hidden;}
body .hw-product-card .by {min-height:18px;}
body .hw-product-card .hw-card-summary {min-height:2.9em;max-height:2.9em;}
body .hw-product-card .hw-card-metrics {min-height:24px;align-content:center;}
body .hw-product-card .pr {display:flex;align-items:center;gap:8px;min-height:44px;margin-top:auto;}
body .hw-product-card .hw-card-actions {margin-top:0;display:grid;gap:8px;}
body .hw-product-card .hw-card-actions .btn {display:flex;align-items:center;justify-content:center;gap:8px;text-align:center;min-height:42px;}
body .hw-product-card .hw-catalog-disabled {opacity:.76;cursor:not-allowed;background:var(--sf);color:var(--mu);border:1px solid var(--ln);}
body .hw-load-more {margin:24px auto 8px;text-align:center;}
body .hw-load-button {display:inline-flex;align-items:center;justify-content:center;gap:10px;min-width:220px;}
body .hw-load-button.is-loading {pointer-events:none;opacity:.72;}
body .hw-load-status {color:var(--mu);font-size:13px;margin:10px 0 0;}
body .hw-grid-note {font-size:12px;color:var(--mu);}
@media(min-width:621px) and (max-width:1100px){body .hw-product-card .hw-card-metrics {min-height:37px;}}
@media(max-width:620px){body .hw-product-card .cb h3{font-size:14px;}body .hw-product-card .hw-card-actions .btn{font-size:13px;}}

/* Larguras do carrossel calculadas no PHP (sem aritmética CSS moderna). */
body .hw-carousel-slide {flex:0 0 calc(var(--hw-slide-pct,33.333333%) - var(--hw-slide-gutter,14.666667px));}
@media(max-width:1100px){body .hw-carousel-slide{flex-basis:calc(var(--hw-slide-pct-tablet,50%) - var(--hw-slide-gutter-tablet,9px));}}
@media(max-width:620px){body .hw-carousel-slide{flex-basis:calc(var(--hw-slide-pct-mobile,100%) - var(--hw-slide-gutter-mobile,0px));}}
