/* Tienda: tarjetas, página de tienda, ficha de producto y bolsa. */

/* ICONO BOLSA CON CONTADOR */
.icon-btn {
  position: relative;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.cart-count {
  position: absolute;
  top: 4px;
  right: 2px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--wine);
  color: var(--ivory);
  font-family: var(--font-sans);
  font-size: 0.625rem;
  font-weight: 600;
  line-height: 17px;
  text-align: center;
}

.cart-count[hidden] {
  display: none;
}

/* FOTO PROVISIONAL */
.jamon-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: var(--ivory-2);
  color: var(--walnut);
}

.jamon-placeholder__svg {
  width: 34%;
  max-width: 150px;
  height: auto;
  opacity: 0.55;
  transform: rotate(-24deg);
}

.jamon-placeholder__note {
  font-family: var(--font-sans);
  font-size: 0.625rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-soft-2);
  text-align: center;
  padding: 0 12px;
}

@media (max-width: 640px) {
  .product-card .jamon-placeholder__note {
    display: none;
  }
}

/* TARJETAS DE PRODUCTO */
.product-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 56px 24px;
}

.product-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
}

.product-card[hidden] {
  display: none;
}

.product-card__media {
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: var(--ivory-2);
}

.product-card__media img,
.product-card__media .jamon-placeholder {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* Fotos de producto: el jamón entero, sin recortar, sobre el blanco de la propia foto */
.product-card__media img {
  object-fit: contain;
  background: #fff;
}

.product-card:hover .product-card__media img,
.product-card:hover .product-card__media .jamon-placeholder {
  transform: scale(1.03);
}

.product-card__body {
  padding-top: 20px;
  text-align: center;
}

.product-card__brand {
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--bronze-dark);
  margin: 0 0 8px;
}

.product-card__name {
  font-size: 1.3rem;
  line-height: 1.3;
  margin: 0 0 6px;
}

.product-card:hover .product-card__name {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}

.product-card__cat {
  font-size: 0.8rem;
  color: var(--ink-soft);
  margin: 0 0 10px;
}

.product-card__price {
  font-size: 0.875rem;
  color: var(--ink);
  margin: 0;
}

@media (max-width: 900px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 44px 16px;
  }
}

@media (max-width: 480px) {
  .product-card__name {
    font-size: 1.1rem;
  }
}

/* SECCIÓN TIENDA EN INICIO */
.shop-home {
  background: #fff;
}

.shop-home__head {
  text-align: center;
  margin-bottom: 40px;
}

.shop-home__head .section-heading,
.shop-home__head .section-lede {
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 640px) {
  .shop-home__head {
    margin-bottom: 32px;
  }
}

/* FILTROS DE LA TIENDA (sutil, estilo Loro Piana: versalitas y una línea que se desliza) */
.shop-toolbar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 4px 0 22px;
  margin-bottom: 52px;
  border-bottom: 1px solid var(--line);
}

.shop-filters {
  position: relative;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px clamp(22px, 3vw, 44px);
  padding-bottom: 8px;
}

.shop-filter {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  line-height: 1.4;
  color: var(--ink-soft-2);
  background: none;
  border: 0;
  padding: 8px 0;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.4s ease;
}

.shop-filter:hover,
.shop-filter.is-active {
  color: var(--ink);
}

.shop-filter:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 4px;
}

/* Línea fina que se desliza bajo el filtro activo */
.shop-filters__indicator {
  position: absolute;
  left: 0;
  top: 0;
  height: 1px;
  width: 0;
  background: var(--ink);
  pointer-events: none;
}

.shop-filters.is-ready .shop-filters__indicator {
  transition: transform 0.55s cubic-bezier(0.65, 0, 0.25, 1), width 0.55s cubic-bezier(0.65, 0, 0.25, 1);
}

/* Tarjetas: fundido suave al cambiar de filtro y entrada escalonada discreta */
.product-grid {
  transition: opacity 0.26s ease;
}

.product-grid.is-leaving {
  opacity: 0;
}

.product-grid.reveal-ready .product-card:not(.is-in) {
  opacity: 0;
}

.product-card.is-in {
  animation: card-in 0.8s cubic-bezier(0.25, 0.6, 0.3, 1) both;
  animation-delay: calc(var(--i, 0) * 70ms);
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

@media (max-width: 640px) {
  .shop-toolbar {
    padding-bottom: 18px;
    margin-bottom: 36px;
  }

  /* En móvil: fila deslizable con los bordes difuminados */
  .shop-filters {
    align-self: stretch;
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    max-width: none;
    margin: 0 -20px;
    padding: 0 20px 8px;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 20px, #000 calc(100% - 28px), transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 20px, #000 calc(100% - 28px), transparent 100%);
  }

  .shop-filters::-webkit-scrollbar {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .shop-filters.is-ready .shop-filters__indicator,
  .product-grid,
  .shop-filter {
    transition: none;
  }

  .product-card.is-in {
    animation: none;
  }
}

/* FICHA DE PRODUCTO */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--ink-soft-2);
  padding: 28px 0 32px;
}

.breadcrumb a {
  color: var(--ink-soft);
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.product {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 72px;
  align-items: start;
  padding-bottom: 120px;
}

.product__gallery {
  position: relative;
}

.product__media {
  aspect-ratio: 4 / 5;
  background: var(--ivory-2);
  overflow: hidden;
}

.product__media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}

.product__seal {
  position: absolute;
  left: 24px;
  bottom: 24px;
  width: 72px;
  height: auto;
}

.product__info {
  position: sticky;
  top: calc(var(--header-h) + 32px);
  max-width: 480px;
}

.product__brand {
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--bronze-dark);
  margin: 0 0 12px;
}

.product__name {
  font-size: clamp(1.9rem, 3vw, 2.5rem);
  line-height: 1.15;
  margin: 0 0 10px;
}

.product__cat {
  font-size: 0.875rem;
  color: var(--ink-soft);
  margin: 0 0 22px;
}

.product__price {
  font-size: 1.05rem;
  margin: 0 0 32px;
}

.format-picker {
  border: 0;
  padding: 0;
  margin: 0 0 24px;
}

.format-picker legend {
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 0;
  margin-bottom: 12px;
}

.format-option {
  display: block;
  cursor: pointer;
}

.format-option + .format-option {
  margin-top: 8px;
}

.format-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.format-option__box {
  display: block;
  border: 1px solid var(--line-strong);
  padding: 16px 18px;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.format-option:hover .format-option__box {
  border-color: var(--ink-soft);
}

.format-option input:checked + .format-option__box {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
  background: #fff;
}

.format-option input:focus-visible + .format-option__box {
  outline: 2px solid var(--bronze-dark);
  outline-offset: 3px;
}

.format-option__name {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 4px;
}

.format-option__detail {
  display: block;
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--ink-soft);
}

.product__buy {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.product__add {
  flex: 1;
  justify-content: center;
}

.product__ask {
  margin-bottom: 40px;
}

.qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
}

.qty button {
  width: 32px;
  height: 32px;
  background: none;
  border: 0;
  font-size: 1rem;
  color: var(--ink);
  cursor: pointer;
}

.qty span {
  min-width: 22px;
  text-align: center;
  font-size: 0.85rem;
}

.qty--lg button {
  width: 44px;
  height: 100%;
  min-height: 50px;
}

/* Acordeón */
.accordion {
  border-top: 1px solid var(--line);
}

.accordion details {
  border-bottom: 1px solid var(--line);
}

.accordion summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}

.accordion summary::-webkit-details-marker {
  display: none;
}

.accordion summary::after {
  content: "+";
  font-size: 1.1rem;
  font-weight: 300;
  letter-spacing: 0;
}

.accordion details[open] summary::after {
  content: "−";
}

.accordion details > :not(summary) {
  font-size: 0.9rem;
  line-height: 1.75;
  color: var(--ink-soft);
  margin: 0 0 16px;
}

.accordion details > :last-child {
  margin-bottom: 24px;
}

.accordion strong {
  font-weight: 500;
  color: var(--ink);
}

.specs {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 24px;
}

.specs dt {
  color: var(--ink);
}

.specs dd {
  margin: 0;
}

.product-missing {
  text-align: center;
  padding: 120px 0;
}

.related {
  border-top: 1px solid var(--line);
  padding: 100px 0 140px;
}

.related h2 {
  font-size: clamp(1.6rem, 2.6vw, 2.2rem);
  text-align: center;
  margin: 0 0 56px;
}

@media (max-width: 900px) {
  .product {
    grid-template-columns: 1fr;
    gap: 40px;
    padding-bottom: 80px;
  }

  .product__info {
    position: static;
    max-width: none;
  }

  .product__seal {
    width: 48px;
    left: 16px;
    top: 16px;
    bottom: auto;
  }

  .related {
    padding: 72px 0 96px;
  }
}

/* BOLSA (panel lateral) */
.cart {
  position: fixed;
  inset: 0;
  z-index: 2000;
  visibility: hidden;
  transition: visibility 0.4s;
}

.cart.is-open {
  visibility: visible;
}

.cart__overlay {
  position: absolute;
  inset: 0;
  background: rgba(33, 26, 20, 0.4);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.cart.is-open .cart__overlay {
  opacity: 1;
}

.cart__panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(440px, 100%);
  background: var(--ivory);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.cart.is-open .cart__panel {
  transform: translateX(0);
}

body.cart-open {
  overflow: hidden;
}

.cart__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 28px;
  border-bottom: 1px solid var(--line);
}

.cart__title {
  font-size: 1.5rem;
  margin: 0;
}

.cart__close {
  width: 40px;
  height: 40px;
  margin-right: -10px;
  display: grid;
  place-items: center;
  background: none;
  border: 0;
  color: var(--ink);
  cursor: pointer;
}

.cart__close svg {
  width: 22px;
  height: 22px;
}

.cart__body {
  flex: 1;
  overflow-y: auto;
  padding: 0 28px;
}

.cart__empty {
  text-align: center;
  padding: 80px 0;
}

.cart__empty p {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  margin: 0 0 24px;
}

.cart-line {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 18px;
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
}

.cart-line__media {
  display: block;
  aspect-ratio: 4 / 5;
  overflow: hidden;
}

.cart-line__media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}

.cart-line__media .jamon-placeholder__note {
  display: none;
}

.cart-line__media .jamon-placeholder__svg {
  width: 44%;
}

.cart-line__brand {
  font-size: 0.625rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--bronze-dark);
  margin: 0 0 4px;
}

.cart-line__name {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  line-height: 1.25;
  margin: 0 0 4px;
}

.cart-line__format {
  font-size: 0.8rem;
  color: var(--ink-soft);
  margin: 0 0 12px;
}

.cart-line__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cart-line__price {
  font-size: 0.875rem;
  margin: 0;
}

.cart-line__remove {
  margin-top: 10px;
  padding: 0;
  background: none;
  border: 0;
  font-size: 0.75rem;
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.cart__foot {
  padding: 22px 28px 28px;
  border-top: 1px solid var(--line);
}

.cart__foot:empty {
  display: none;
}

.cart__total {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 18px;
}

.cart__checkout {
  width: 100%;
  justify-content: center;
}

.cart__note {
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--ink-soft);
  text-align: center;
  margin: 14px 0 0;
}

@media (max-width: 480px) {
  .cart__head,
  .cart__body,
  .cart__foot {
    padding-left: 20px;
    padding-right: 20px;
  }
}
