/* =====================================================================
   purchase-buttons.css
   Public storefront styling for product-card purchase buttons.
   Loaded AFTER legacy.css and checkout-reference.css, so a handful of
   scoped `!important` rules neutralise the legacy button sizing.
   Scope: .products-grid / .product-card only.
   Untouched: .final-actions, checkout modal, availability, routing.
   Presentation only - no payment, auth or JS logic.
   ===================================================================== */

/* --------------------------------------------------------------
   1. Equal-height cards (both products share one row height)
   -------------------------------------------------------------- */
.products-grid {
  align-items: stretch;
}

.product-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
}

.product-card-content {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
}

/* Push the purchase area to the bottom of every card: the final
   colour note absorbs the free space, then keeps 14px before the CTAs. */
.product-card-content > .color-note:last-of-type {
  margin-top: auto;
  margin-bottom: 14px;
  padding-top: 20px;
}

/* --------------------------------------------------------------
   2. Actions container
   Default = one column (mobile -> 1099px). Two columns only >=1100px.
   -------------------------------------------------------------- */
.product-card .purchase-actions {
  display: grid !important;               /* beat legacy display:flex */
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  gap: 12px !important;                   /* beat legacy gap:0 */
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
}

/* --------------------------------------------------------------
   3. Shared look for every action (button + anchors)
   -------------------------------------------------------------- */
.product-card .purchase-actions > .marketplace-link {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 4px 10px;
  width: 100%;
  min-width: 0;
  min-height: 60px !important;
  margin: 0 !important;
  padding: 10px 14px !important;
  border: 0 !important;
  border-radius: 12px !important;
  box-shadow: none !important;
  box-sizing: border-box;
  font-family: inherit;
  font-size: 15px !important;
  font-weight: 700 !important;
  line-height: 1.3 !important;
  letter-spacing: normal !important;
  text-align: center;
  text-decoration: none;
  white-space: normal;
  overflow-wrap: anywhere;
  transform: none;
  transition: filter .18s ease;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

/* Icons: fixed size, never shrink. */
.product-card .purchase-actions > .marketplace-link svg,
.product-card .purchase-actions > .marketplace-link img {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
}

.product-card .purchase-actions > .marketplace-link > span {
  min-width: 0;
}

.product-card .purchase-actions > .stock-unavailable {
  grid-column: 1 / -1;
}

/* Optional note inside a link drops to its own centred line. */
.product-card .purchase-actions > .marketplace-link small {
  flex-basis: 100%;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.3;
}

/* --------------------------------------------------------------
   4. Brand surfaces (accessible contrast, no shadow)
   -------------------------------------------------------------- */
/* Website purchase - branded amber, dark text. */
.product-card .purchase-actions > .direct-buy {
  flex: 0 0 auto;                         /* reset inherited flex sizing */
  grid-column: 1 / -1;                    /* always spans the row */
  color: #1a1206 !important;
  background: linear-gradient(180deg, #ffc65c, #f0a93b) !important;
}

/* Ozon - branded blue, white text. */
.product-card .purchase-actions > .ozon-link {
  color: #fff !important;
  background: #005bff !important;
}

/* Yandex Market - branded yellow, near-black text. */
.product-card .purchase-actions > .yandex-temporary {
  color: #191b20 !important;
  background: #ffda55 !important;
}

/* --------------------------------------------------------------
   5. Hover / focus / motion
   -------------------------------------------------------------- */
.product-card .purchase-actions > .marketplace-link:hover {
  transform: none !important;             /* kill legacy translateY */
  filter: brightness(1.08);               /* subtle, no layout jump */
}

.product-card .purchase-actions > .marketplace-link:focus-visible {
  outline: 3px solid #fff !important;
  outline-offset: 3px !important;
}

@media (prefers-reduced-motion: reduce) {
  .product-card .purchase-actions > .marketplace-link {
    transition: none;
  }
}

@media (max-width: 380px) {
  .product-card .purchase-actions > .marketplace-link {
    padding-inline: 10px !important;
    gap: 6px;
    font-size: 14px !important;
  }
}

/* --------------------------------------------------------------
   6. Two-column layout from 1100px up
   Row 1: website button spans all. Row 2: marketplaces side by side.
   A lone second child (starter's Yandex) spans the whole row too.
   -------------------------------------------------------------- */
@media (min-width: 1100px) {
  .product-card .purchase-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .product-card .purchase-actions > .marketplace-link:nth-child(2):last-child {
    grid-column: 1 / -1;
  }
}
