body.esp-redesign .esp-card-buy { display:flex; flex-wrap:wrap; align-items:center; justify-content:flex-end; gap:6px 12px; }
body.esp-redesign .esp-card-buy form { margin:0; }
.esp-sold-out-badge { position:absolute; inset:10px auto auto 10px; z-index:4; padding:5px 12px; color:white; background:#ad9962; border-radius:3px; font-weight:700; font-size:14px; letter-spacing:.5px; text-transform:uppercase; }
:is(.esp-product-card__media,.esp-product-gallery):has(.esp-sold-out-badge) :is(.best-seller-badge:not(.esp-sold-out-badge),.onsale) { display:none !important; }
body.esp-redesign #main button.esp-sold-out-button:disabled { margin:0; min-height:44px; padding:10px 16px; border:0; border-radius:8px; background:#e9e5de; color:#625e57; opacity:1; box-shadow:none; cursor:not-allowed; font:500 15px/1.3 var(--esp-font-body,Poppins,sans-serif); }
body.esp-redesign #main .esp-product-summary > button.esp-sold-out-button:disabled { width:100%; min-height:52px; margin-block:4px 12px; font-size:16px; }
body.esp-redesign .esp-card-box { color:#795921; font-size:13px; line-height:1.3; text-decoration:underline; text-underline-offset:3px; }
body.esp-redesign :is(.esp-product-card,.esp-search-pc-v57__product) .esp-card-add { display:inline-flex; align-items:center; justify-content:center; padding:10px 16px; min-height:42px; margin:0; border:0; border-radius:7px; background:#201913; color:#fff; font:500 15px/1.25 Poppins,sans-serif; white-space:nowrap; cursor:pointer; }
body.esp-redesign .esp-card-buy :is(a,button):focus-visible { outline:2px solid #956d29; outline-offset:3px; }
body.esp-redesign .esp-product-card .store-product__image:hover img:not(.store-product__image--alt) { opacity:1!important; visibility:visible; }
body.esp-redesign .esp-product-card .esp-product-card__media .store-product__image--alt { display:none!important; }

@media screen {
  body.esp-redesign.esp-catalog-shopping #main .esp-product-card > .esp-product-card__purchase {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    row-gap: 10px;
  }
  body.esp-redesign.esp-catalog-shopping #main .esp-product-card__purchase > .esp-product-card__actions {
    align-self: end;
    justify-content: flex-end;
  }
  body.esp-redesign.esp-catalog-shopping #main .esp-product-card__actions .esp-card-buy {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    width: 100%;
    gap: 8px;
  }
  body.esp-redesign.esp-catalog-shopping #main .esp-card-buy form { grid-column: 2; }
  body.esp-redesign.esp-catalog-shopping #main .esp-card-buy .esp-card-add { margin: 0; }

  /* Each visual row shares its title, price and action tracks, even with mixed product types. */
  @supports (grid-template-rows: subgrid) {
    body.esp-redesign.esp-catalog-shopping.esp-figma-catalog #main ul.products.esp-product-grid > li.esp-product-card {
      display: grid;
      grid-row: span 4;
      grid-template-rows: subgrid;
      row-gap: 0;
    }
    body.esp-redesign.esp-catalog-shopping.esp-figma-catalog #main .esp-product-card > .esp-product-card__purchase {
      grid-row: span 2;
      grid-template-rows: subgrid;
      margin-block-start: 0;
    }
  }
}

/* Compact cards keep their existing two-column catalog, with full-width touch controls. */
@media (max-width: 639px) {
  body.esp-redesign.esp-catalog-shopping #main .esp-product-card__actions .esp-card-buy {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(24px, auto) auto;
    gap: 4px;
  }
  body.esp-redesign.esp-catalog-shopping #main .esp-card-buy form { grid-area: 2 / 1; }
  body.esp-redesign.esp-catalog-shopping #main .esp-card-buy:not(:has(.esp-card-box)) { grid-template-rows: auto; }
  body.esp-redesign.esp-catalog-shopping #main .esp-card-buy form:only-child { grid-row: 1; }
  body.esp-redesign.esp-catalog-shopping #main .esp-card-buy .esp-card-add { width: 100%; }
  body.esp-redesign.esp-catalog-shopping #main .esp-card-box { justify-self: start; padding-block: 3px; }
}
/* Keep the original white enamel, fine gold hardware and contact shadows on the catalog surface. */
body.esp-redesign #main ul.products > li.esp-product-card:is(.product_cat-cigars:not(.product_cat-humidors), .esp-cigar-edition-card),
body.esp-redesign #main ul.products > li.esp-product-card:is(.product_cat-cigars:not(.product_cat-humidors), .esp-cigar-edition-card) > .esp-product-card__media {
  background-color: #f3ebde;
}
.esp-product-card__media .esp-catalog-still--lighter {
  --esp-subject-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 480 480'%3E%3Cdefs%3E%3Cfilter id='edge' x='-30%25' y='-45%25' width='160%25' height='190%25'%3E%3CfeGaussianBlur stdDeviation='4'/%3E%3C/filter%3E%3Cfilter id='soft' x='-30%25' y='-100%25' width='160%25' height='300%25'%3E%3CfeGaussianBlur stdDeviation='7'/%3E%3C/filter%3E%3C/defs%3E%3Cellipse cx='254' cy='401' rx='163' ry='17' filter='url(%23soft)'/%3E%3Cpath d='M114 154L143 149 145 114Q119 119 114 104Q109 85 129 82L167 82 178 77 211 78 216 85 234 80 269 77 275 70 313 67 350 69 356 78 354 150 366 153 371 163 371 403Q354 412 333 413L122 413Q108 411 108 400L108 167Z' filter='url(%23edge)'/%3E%3C/svg%3E");
}
.esp-product-card__media .esp-catalog-still--ashtray {
  --esp-subject-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 480 480'%3E%3Cdefs%3E%3Cfilter id='edge' x='-20%25' y='-25%25' width='140%25' height='150%25'%3E%3CfeGaussianBlur stdDeviation='4'/%3E%3C/filter%3E%3Cfilter id='soft' x='-20%25' y='-90%25' width='140%25' height='280%25'%3E%3CfeGaussianBlur stdDeviation='8'/%3E%3C/filter%3E%3C/defs%3E%3Cellipse cx='234' cy='350' rx='181' ry='34' filter='url(%23soft)'/%3E%3Cpath d='M44 216Q44 190 66 179L77 158 111 151Q194 115 275 130L307 130 325 145Q388 154 413 183L427 193Q441 208 439 237L435 291Q432 333 407 348Q348 391 245 390Q125 391 69 350Q48 335 44 306Q38 268 44 216Z' filter='url(%23edge)'/%3E%3C/svg%3E");
}
.esp-product-card__media img.esp-catalog-still {
  object-fit: contain;
  object-position: center;
  -webkit-mask: var(--esp-subject-mask) center / contain no-repeat;
  mask: var(--esp-subject-mask) center / contain no-repeat;
}
.esp-product-card__media img.esp-catalog-still--lighter {
  transform: translateY(5%) scale(.88);
}
.esp-product-card__media img.esp-catalog-still--ashtray {
  transform: translateY(4%);
}
@media (max-width: 767px) {
  .esp-product-card__media img.esp-catalog-still--lighter {
    transform: translateY(9%) scale(.8);
  }
}

/* The regional preview cards share the same photo well as neighboring WooCommerce cards. */
#main .esp-product-grid .esp-cigar-edition-card .esp-product-card__media > a {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
}
#main .esp-product-grid .esp-cigar-edition-card .esp-product-card__media > a > img {
  width: min(213px, 100%);
  height: min(214px, 100%);
  object-fit: contain;
}
/* The Mi Familia box is wider than a single cigar. Give its lid room below the card controls. */
.esp-product-card.product_cat-cigars .esp-product-card__media:has(.best-seller-badge) > a[href*="/mi-familia-limited-edition/"] > img {
  transform: translateY(9%) scale(.84);
}
@media (max-width: 767px) {
  #main .esp-product-grid .esp-cigar-edition-card .esp-product-card__media > a > img {
    width: 100%;
    height: 100%;
  }
  .esp-product-card.product_cat-cigars .esp-product-card__media:has(.best-seller-badge) > a > img {
    transform: translateX(7%);
  }
  .esp-product-card.product_cat-cigars .esp-product-card__media:has(.best-seller-badge) > a[href*="/mi-familia-limited-edition/"] > img {
    transform: translateY(16%) scale(.7);
  }
}
