/* ==========================================================================
   AURORA JOIAS - VITRINE DE PRODUTOS (cards do loop WooCommerce)
   Somente CSS: usa as classes nativas do WooCommerce, preservando hooks,
   variações, estoque, AJAX de "adicionar ao carrinho" e plugins.
   ========================================================================== */

body ul.products {
  --sh-card: #fbfaf8;          /* off-white do card (as imagens se fundem a ele) */
  --sh-line: #ece7de;
  --sh-line-hover: #d9c7a3;
  --sh-text: #1b1b1b;
  --sh-muted: #8b867d;
  --sh-old: #b8b3aa;
  --sh-gold: var(--color-gold, #c5a880);
  --sh-gold-ink: #8a6d3b;
  --sh-dark: var(--color-obsidian, #0e0e0e);
  --sh-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --sh-inst-h: 18px;           /* altura reservada p/ a linha de parcelamento */

  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 28px;
  margin: 0;
  padding: 0;
  list-style: none;
  align-items: stretch;
}
body ul.products.columns-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
body ul.products.columns-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
body ul.products.columns-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
body ul.products.columns-5,
body ul.products.columns-6 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
body ul.products::before,
body ul.products::after { display: none; }

/* ---------- Card ---------- */
body ul.products li.product {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  float: none;
  width: auto;
  min-width: 0;
  margin: 0;
  padding: 0;
  text-align: center;
  background: var(--sh-card);
  border: 1px solid var(--sh-line);
  border-radius: 6px;
  overflow: hidden;
  transition: transform .45s var(--sh-ease), box-shadow .45s var(--sh-ease), border-color .45s var(--sh-ease);
}
body ul.products li.product:hover,
body ul.products li.product:focus-within {
  transform: translateY(-4px);
  border-color: var(--sh-line-hover);
  box-shadow: 0 18px 38px rgba(30, 22, 8, 0.09), 0 2px 6px rgba(30, 22, 8, 0.04);
}

/* Link principal (imagem + título + preço) */
body ul.products li.product > a.woocommerce-LoopProduct-link,
body ul.products li.product > a.woocommerce-loop-product__link {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex: 1 1 auto;
  width: auto;
  color: inherit;
  text-decoration: none;
}
body ul.products li.product a:focus-visible {
  outline: 2px solid var(--sh-gold-ink);
  outline-offset: -2px;
}

/* ---------- Imagem: área quadrada uniforme, sem cortar nem distorcer ---------- */
body ul.products li.product img.attachment-woocommerce_thumbnail,
body ul.products li.product a > img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: contain;          /* mostra a peça inteira */
  object-position: center;
  padding: 7%;                  /* respiro ao redor da joia */
  margin: 0;
  background: transparent;
  border-radius: 0;
  mix-blend-mode: multiply;     /* fundo branco da foto se funde ao off-white do card */
  transition: padding .6s var(--sh-ease), opacity .3s ease;
}
body ul.products li.product:hover img.attachment-woocommerce_thumbnail,
body ul.products li.product:hover a > img {
  padding: 4%;                  /* "zoom" suave sem estourar o card */
}

/* ---------- Selo de oferta ---------- */
body .onsale,
body span.onsale {
  position: absolute;
  top: 14px;
  left: 14px;
  right: auto;
  z-index: 3;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 6px 13px 5px;
  font-family: var(--font-serif);
  font-size: 12.5px;
  font-weight: 700;
  font-style: normal;
  line-height: 1.2;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: #4d3d1d;
  background: linear-gradient(135deg, #f1e4c9 0%, #dfc9a0 100%);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 3px;
  box-shadow: 0 2px 8px rgba(120, 90, 30, 0.14);
}

/* Esgotado */
body ul.products li.product.outofstock > a::after {
  content: "Esgotado";
  position: absolute;
  top: 14px;
  right: 14px;
  padding: 5px 11px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: #6b665d;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--sh-line);
  border-radius: 3px;
}
body ul.products li.product.outofstock img.attachment-woocommerce_thumbnail { opacity: .55; }

/* ---------- Título ---------- */
body ul.products li.product .woocommerce-loop-product__title,
body ul.products li.product h2.woocommerce-loop-product__title {
  flex: 1 0 auto;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  min-height: calc(1.35em * 2);
  margin: 0 0 14px;
  padding: 4px 20px 0;
  font-family: var(--font-serif);
  font-size: 19.5px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.2px;
  color: var(--sh-text);
  text-align: center;
  transition: color .3s ease;
}
body ul.products li.product:hover .woocommerce-loop-product__title { color: var(--sh-gold-ink); }

/* Avaliação (se existir) */
body ul.products li.product .star-rating { margin: 0 auto 10px; font-size: 12px; }

/* ---------- Preços ---------- */
body ul.products li.product .price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 2px 10px;
  margin: 0 0 6px;
  padding: 0 16px;
  font-family: var(--font-sans);
  font-size: 19px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.2px;
  color: var(--sh-text);
}
/* preço promocional primeiro, preço antigo riscado depois */
body ul.products li.product .price ins {
  order: 1;
  margin: 0;
  background: none;
  text-decoration: none;
  font-size: 21px;
  font-weight: 700;
  color: var(--sh-text);
}
body ul.products li.product .price del {
  order: 2;
  font-size: 13px;
  font-weight: 400;
  color: var(--sh-old);
  opacity: 1;
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}
body ul.products li.product .price del .amount,
body ul.products li.product .price del bdi { color: inherit; font-weight: inherit; }

/* Parcelamento: altura fixa para alinhar todos os cards */
body ul.products li.product .aurora-installments {
  height: var(--sh-inst-h);
  margin: 0 0 18px;
  padding: 0 14px;
  font-size: 12px;
  line-height: var(--sh-inst-h);
  color: var(--sh-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body ul.products li.product .aurora-installments strong { font-weight: 600; color: #4a463f; }
/* Card sem parcelamento: reserva o mesmo espaço (alinha preço e botão) */
body ul.products li.product:not(:has(.aurora-installments)) .price {
  margin-bottom: calc(6px + var(--sh-inst-h) + 18px);
}

/* ---------- Botão ---------- */
body ul.products li.product a.button,
body ul.products li.product button.button,
body ul.products li.product .add_to_cart_button,
body ul.products li.product a.added_to_cart {
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  width: auto;
  min-height: 48px;
  margin: 0 20px 20px;
  padding: 0 16px;
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  text-align: center;
  text-decoration: none;
  color: #ffffff;
  background: var(--sh-dark);
  border: 1px solid var(--sh-dark);
  border-radius: 4px;
  cursor: pointer;
  transition: background-color .35s var(--sh-ease), color .35s var(--sh-ease), border-color .35s var(--sh-ease), box-shadow .35s var(--sh-ease), transform .2s ease;
}
body ul.products li.product a.button:hover,
body ul.products li.product button.button:hover,
body ul.products li.product .add_to_cart_button:hover {
  color: #1b1b1b;
  background: var(--sh-gold);
  border-color: var(--sh-gold);
  box-shadow: 0 8px 20px rgba(179, 147, 104, 0.35);
}
body ul.products li.product a.button:active { transform: scale(0.985); }
body ul.products li.product a.button:focus-visible {
  outline: 2px solid var(--sh-gold-ink);
  outline-offset: 2px;
}

/* Produto esgotado / "Leia mais": botão secundário */
body ul.products li.product.outofstock a.button,
body ul.products li.product a.button:not(.add_to_cart_button):not(.product_type_variable) {
  color: var(--sh-dark);
  background: transparent;
  border-color: var(--sh-line-hover);
}
body ul.products li.product.outofstock a.button:hover,
body ul.products li.product a.button:not(.add_to_cart_button):not(.product_type_variable):hover {
  color: #fff;
  background: var(--sh-dark);
  border-color: var(--sh-dark);
  box-shadow: none;
}

/* Estado "carregando" (AJAX) */
body ul.products li.product a.button.loading {
  pointer-events: none;
  opacity: .85;
  background: #2a2a2a;
  border-color: #2a2a2a;
  color: #fff;
}
body ul.products li.product a.button.loading::after {
  content: "";
  flex: none;
  width: 12px;
  height: 12px;
  margin-left: 10px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: aurora-spin .7s linear infinite;
}
@keyframes aurora-spin { to { transform: rotate(360deg); } }

/* Após adicionar: o botão cede lugar ao "Ver carrinho", na MESMA posição e tamanho (sem quebra de layout) */
body ul.products li.product a.button.added { display: none; }
body ul.products li.product a.added_to_cart {
  color: var(--sh-dark);
  background: transparent;
  border-color: var(--sh-gold);
  animation: aurora-fade-in .4s ease both;
}
body ul.products li.product a.added_to_cart:hover {
  color: #1b1b1b;
  background: var(--sh-gold);
  border-color: var(--sh-gold);
}
@keyframes aurora-fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- Barra superior da loja (contagem / ordenação) ---------- */
.woocommerce-result-count { font-size: 13px; color: #8b867d; letter-spacing: .3px; }
.woocommerce-ordering select {
  min-height: 44px;
  padding: 0 40px 0 16px;
  font-size: 13px;
  background-color: #fff;
  border: 1px solid #e3ddd0;
  border-radius: 4px;
}

/* ---------- Tablet ---------- */
@media (max-width: 1100px) {
  body ul.products,
  body ul.products.columns-4,
  body ul.products.columns-5,
  body ul.products.columns-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
  body ul.products.columns-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Celular: duas colunas ---------- */
@media (max-width: 768px) {
  body ul.products,
  body ul.products.columns-3,
  body ul.products.columns-4,
  body ul.products.columns-5,
  body ul.products.columns-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

  body ul.products li.product { border-radius: 5px; }
  body ul.products li.product:hover { transform: none; box-shadow: none; }
  body ul.products li.product img.attachment-woocommerce_thumbnail,
  body ul.products li.product a > img { padding: 5%; }
  body ul.products li.product:hover img.attachment-woocommerce_thumbnail { padding: 5%; }

  body .onsale, body span.onsale { top: 8px; left: 8px; padding: 4px 9px 3px; font-size: 10.5px; letter-spacing: 1.2px; }

  body ul.products li.product .woocommerce-loop-product__title {
    padding: 2px 10px 0;
    margin-bottom: 10px;
    font-size: 16px;
    -webkit-line-clamp: 3;
  }
  body ul.products li.product .price { padding: 0 8px; gap: 0 8px; font-size: 16px; }
  body ul.products li.product .price ins { font-size: 17px; }
  body ul.products li.product .price del { font-size: 12px; }

  body ul.products li.product .aurora-installments { padding: 0 8px; font-size: 11.5px; margin-bottom: 14px; }
  body ul.products li.product .installment-label,
  body ul.products li.product .installment-suffix { display: none; }   /* "10x de R$ 248,90" cabe em 2 colunas */
  body ul.products li.product:not(:has(.aurora-installments)) .price { margin-bottom: calc(6px + var(--sh-inst-h) + 14px); }

  body ul.products li.product a.button,
  body ul.products li.product button.button,
  body ul.products li.product a.added_to_cart {
    min-height: 44px;
    margin: 0 10px 12px;
    padding: 0 8px;
    font-size: 10px;
    letter-spacing: .8px;
  }
  body ul.products li.product.outofstock > a::after { top: 8px; right: 8px; font-size: 9.5px; padding: 3px 8px; }
}

/* Telas muito estreitas: preserva legibilidade */
@media (max-width: 360px) {
  body ul.products li.product .woocommerce-loop-product__title { font-size: 15px; }
  body ul.products li.product a.button { font-size: 9.5px; letter-spacing: .5px; }
}

@media (prefers-reduced-motion: reduce) {
  body ul.products li.product,
  body ul.products li.product img,
  body ul.products li.product a.button,
  body ul.products li.product .woocommerce-loop-product__title { transition: none !important; animation: none !important; }
  body ul.products li.product:hover { transform: none; }
}
