/* QT Storefront Cards: one owner for action layout and control presentation. */

.qt-storefront ul.products > li.product {
  padding: var(--qt-space-3);
}

.qt-storefront ul.products > li.product .ct-woo-card-actions {
  margin-top: var(--qt-space-4);
}

.qt-storefront-card-actions {
  --qt-card-control-size: var(--qt-control-size);
  --qt-card-icon-size: var(--qt-icon-size);
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--qt-card-control-size) var(--qt-card-control-size);
  gap: var(--qt-space-2);
  align-items: stretch;
  width: 100%;
}

.qt-storefront-card-primary,
.qt-storefront-card-actions .tinvwl_add_to_wishlist_button,
.qt-storefront-card-share {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--qt-card-control-size);
  border: 1px solid var(--qt-color-brand);
  border-radius: var(--qt-radius-md);
  font-family: var(--qt-font-body);
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  transition: background-color var(--qt-transition-fast), border-color var(--qt-transition-fast), color var(--qt-transition-fast), transform var(--qt-transition-fast);
}

/* These scoped selectors intentionally outrank Blocksy and the remaining
 * global design-system rules without using !important. */
body.qt-storefront ul.products > li.product .qt-storefront-card-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--qt-card-control-size) var(--qt-card-control-size);
  gap: var(--qt-space-2);
  align-items: stretch;
}

body.qt-storefront ul.products > li.product .qt-storefront-card-primary,
body.qt-storefront ul.products > li.product .qt-storefront-card-actions .tinvwl_add_to_wishlist_button,
body.qt-storefront ul.products > li.product .qt-storefront-card-share {
  min-height: var(--qt-card-control-size);
  height: var(--qt-card-control-size);
  margin: 0;
  padding: 0;
  line-height: 1;
}

body.qt-storefront ul.products > li.product .qt-storefront-card-primary {
  display: inline-flex;
  width: 100%;
}

body.qt-storefront ul.products > li.product .qt-storefront-card-actions .tinvwl-loop-button-wrapper {
  width: var(--qt-card-control-size);
  min-width: var(--qt-card-control-size);
}

.qt-storefront-card-primary {
  gap: var(--qt-space-2);
  padding: 0 var(--qt-space-4);
  color: #fff;
  background: var(--qt-color-brand);
}

.qt-storefront-card-primary:hover {
  color: #fff;
  background: var(--qt-color-brand-strong);
  border-color: var(--qt-color-brand-strong);
}

.qt-storefront-card-primary:focus-visible,
.qt-storefront-card-actions .tinvwl_add_to_wishlist_button:focus-visible,
.qt-storefront-card-share:focus-visible,
.qt-share-dialog__close:focus-visible,
.qt-share-dialog__grid button:focus-visible {
  outline: 0;
  box-shadow: var(--qt-shadow-focus);
}

.qt-storefront-card-primary--sold-out {
  color: var(--qt-color-muted);
  background: #f3eaf0;
  border-color: var(--qt-color-border);
  cursor: not-allowed;
}

.qt-storefront-card-primary__icon,
.qt-storefront-card-share svg {
  display: inline-flex;
  flex: 0 0 auto;
  width: var(--qt-card-icon-size);
  height: var(--qt-card-icon-size);
}

.qt-storefront-card-primary__icon svg {
  width: 100%;
  height: 100%;
}

.qt-storefront-card-primary__icon svg,
.qt-storefront-card-share svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.qt-storefront-card-actions .tinvwl-loop-button-wrapper {
  min-width: 0;
}

/* The wishlist plugin supplies its glyph as a pseudo-element. Keep it on the
 * shared card icon scale without depending on plugin-global button styles. */
body.qt-storefront ul.products > li.product .qt-storefront-card-actions .tinvwl_add_to_wishlist_button::before {
  width: var(--qt-card-icon-size);
  height: var(--qt-card-icon-size);
  font-size: var(--qt-card-icon-size);
  line-height: var(--qt-card-icon-size);
}

.qt-storefront-card-actions .tinvwl_add_to_wishlist_button,
.qt-storefront-card-share {
  width: var(--qt-card-control-size);
  padding: 0;
  color: var(--qt-color-brand);
  background: var(--qt-color-surface);
}

/* The wishlist plugin normally renders a font glyph. Replace it with the
 * same 20px SVG-style heart treatment used by the card action system so it
 * aligns visually with the adjacent share control in every state. */
body.qt-storefront ul.products > li.product .qt-storefront-card-actions .tinvwl_add_to_wishlist_button::before {
  content: '';
  display: block;
  width: var(--qt-card-icon-size);
  height: var(--qt-card-icon-size);
  margin: 0;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78L12 21.23l8.84-8.84a5.5 5.5 0 0 0 0-7.78Z' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78L12 21.23l8.84-8.84a5.5 5.5 0 0 0 0-7.78Z' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

body.qt-storefront ul.products > li.product .qt-storefront-card-actions .tinvwl_add_to_wishlist_button.tinvwl-product-in-list::before,
body.qt-storefront ul.products > li.product .qt-storefront-card-actions .tinvwl_add_to_wishlist_button.tinvwl-added::before {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78L12 21.23l8.84-8.84a5.5 5.5 0 0 0 0-7.78Z' fill='%23000'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78L12 21.23l8.84-8.84a5.5 5.5 0 0 0 0-7.78Z' fill='%23000'/%3E%3C/svg%3E") center / contain no-repeat;
}

.qt-storefront-card-actions .tinvwl_add_to_wishlist_button:hover,
.qt-storefront-card-share:hover {
  color: #fff;
  background: var(--qt-color-brand);
}

.qt-storefront-card-actions .tinvwl_add_to_wishlist-text,
.qt-storefront-card-actions .tinvwl_remove_from_wishlist-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.qt-share-dialog {
  width: min(31rem, calc(100vw - 2rem));
  padding: 0;
  color: var(--qt-color-ink);
  border: 0;
  border-radius: var(--qt-radius-lg);
  box-shadow: 0 1.5rem 4rem rgb(52 33 44 / 28%);
}

.qt-share-dialog::backdrop {
  background: rgb(52 33 44 / 54%);
}

.qt-share-dialog__panel {
  padding: var(--qt-space-5);
  background: var(--qt-color-surface);
}

.qt-share-dialog__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--qt-space-3);
}

.qt-share-dialog__header p {
  margin: 0 0 var(--qt-space-1);
  color: var(--qt-color-brand);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.qt-share-dialog__header h2 {
  margin: 0;
  font-family: var(--qt-font-display);
  font-size: 1.5rem;
  line-height: 1.15;
}

.qt-share-dialog__close {
  display: inline-grid;
  flex: 0 0 2.5rem;
  width: 2.5rem;
  height: 2.5rem;
  place-items: center;
  color: var(--qt-color-brand);
  border: 0;
  border-radius: 50%;
  background: var(--qt-color-brand-soft);
  cursor: pointer;
}

.qt-share-dialog__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--qt-space-2);
  margin-top: var(--qt-space-5);
}

.qt-share-dialog__grid button {
  display: grid;
  min-height: 5rem;
  place-items: center;
  gap: var(--qt-space-1);
  padding: var(--qt-space-2);
  color: var(--qt-color-ink);
  border: 1px solid var(--qt-color-border);
  border-radius: var(--qt-radius-sm);
  background: #fff;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.qt-share-dialog__grid img,
.qt-share-dialog__grid svg {
  width: 1.5rem;
  height: 1.5rem;
}

.qt-share-dialog__status {
  min-height: 1.25rem;
  margin: var(--qt-space-3) 0 0;
  color: var(--qt-color-muted);
  font-size: 0.8125rem;
}

/* Desktop: 1200px and above. Full text primary action + two 50px icon actions. */
@media (min-width: 1200px) {
  body.qt-storefront ul.products > li.product .qt-storefront-card-actions {
    grid-template-columns: minmax(0, 1fr) var(--qt-card-control-size) var(--qt-card-control-size);
  }
}

/* Laptop: 1024px–1199px. Preserve the same desktop action hierarchy. */
@media (min-width: 1024px) and (max-width: 1199px) {
  body.qt-storefront ul.products > li.product .qt-storefront-card-actions {
    grid-template-columns: minmax(0, 1fr) var(--qt-card-control-size) var(--qt-card-control-size);
  }
}

/* Tablet: 768px–1023px. A compact but still labelled primary action. */
@media (min-width: 768px) and (max-width: 1023px) {
  .qt-storefront-card-actions {
    --qt-card-control-size: 3rem;
  }

  body.qt-storefront ul.products > li.product .qt-storefront-card-actions {
    grid-template-columns: minmax(0, 1fr) var(--qt-card-control-size) var(--qt-card-control-size);
  }

  body.qt-storefront ul.products > li.product .qt-storefront-card-primary,
  body.qt-storefront ul.products > li.product .qt-storefront-card-actions .tinvwl_add_to_wishlist_button,
  body.qt-storefront ul.products > li.product .qt-storefront-card-share {
    min-height: var(--qt-card-control-size);
    height: var(--qt-card-control-size);
  }

  body.qt-storefront ul.products > li.product .qt-storefront-card-actions .tinvwl-loop-button-wrapper {
    width: var(--qt-card-control-size);
    min-width: var(--qt-card-control-size);
  }
}

/* Mobile: 480px–767px. Three equal controls prevent label wrapping. */
@media (min-width: 480px) and (max-width: 767px) {
  body.qt-storefront ul.products > li.product .qt-storefront-card-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  body.qt-storefront ul.products > li.product .qt-storefront-card-primary {
    gap: 0;
  }

  body.qt-storefront ul.products > li.product .qt-storefront-card-primary__label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
}

/* Compact mobile: up to 479px. Keep cart, wishlist, and share in a single
 * equal-width row. Labels are hidden so the controls never wrap. */
@media (max-width: 479px) {
  .qt-storefront-card-actions {
    --qt-card-control-size: var(--qt-control-size-compact);
    --qt-card-icon-size: var(--qt-icon-size-compact);
  }
  .qt-storefront ul.products > li.product {
    padding: var(--qt-space-3);
  }

  .qt-storefront-card-actions,
  body.qt-storefront ul.products > li.product .qt-storefront-card-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .qt-storefront-card-primary,
  .qt-storefront-card-actions .tinvwl_add_to_wishlist_button,
  .qt-storefront-card-share {
    min-height: var(--qt-card-control-size);
  }

  .qt-storefront-card-actions .tinvwl_add_to_wishlist_button,
  .qt-storefront-card-share {
    width: var(--qt-card-control-size);
  }

  .qt-storefront-card-primary__icon,
  .qt-storefront-card-share svg {
    width: var(--qt-card-icon-size);
    height: var(--qt-card-icon-size);
  }

  body.qt-storefront ul.products > li.product .qt-storefront-card-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  body.qt-storefront ul.products > li.product .qt-storefront-card-primary,
  body.qt-storefront ul.products > li.product .qt-storefront-card-actions .tinvwl_add_to_wishlist_button,
  body.qt-storefront ul.products > li.product .qt-storefront-card-share {
    min-height: var(--qt-card-control-size);
    height: var(--qt-card-control-size);
  }

  body.qt-storefront ul.products > li.product .qt-storefront-card-actions .tinvwl-loop-button-wrapper {
    width: 100%;
    min-width: 0;
  }

  body.qt-storefront ul.products > li.product .qt-storefront-card-primary {
    grid-column: auto;
    gap: 0;
  }

  body.qt-storefront ul.products > li.product .qt-storefront-card-actions .tinvwl_add_to_wishlist_button,
  body.qt-storefront ul.products > li.product .qt-storefront-card-share {
    width: 100%;
  }

  body.qt-storefront ul.products > li.product .qt-storefront-card-primary__label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
}
