/* =====================================================================
   Product cards — vaulted product cards with a spec table and LIVE buy/sell.
   Responsive grid of cards (stack on mobile). Each card: name + ticker chip,
   a vault/insurer detail list, a spec table (Allocation / Buy / Sell /
   Storage / Premium) and a "Buy Now" CTA. Buy/Sell figures are filled live by
   prices.js. Table look modelled on price-grids; BEM, section-scoped.
   Content locked to the 1240 area via .container. Tokens only.
   ===================================================================== */

.product-cards {
  padding-block: var(--home-sec-pad-y);
}

.product-cards__inner {
  display: flex;
  flex-direction: column;
  gap: var(--home-stack-gap);
}

/* ---- Header (optional heading + intro) ---- */
.product-cards__head {
  display: flex;
  flex-direction: column;
  gap: var(--cb-list-gap);
  text-align: center;
}
.product-cards__heading {
  margin: 0;
  font-weight: var(--fw-medium);
  font-size: var(--fs-32);
  line-height: var(--lh-45);
  color: var(--gray-8);
  word-break: break-word;
}
.product-cards__intro {
  margin: 0;
  font-weight: var(--fw-regular);
  font-size: var(--fs-18);
  line-height: var(--lh-25);
  color: var(--color-text-muted);
  word-break: break-word;
}

/* ---- Responsive grid of cards ---- */
.product-cards__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);   /* 2 x 2 */
  gap: var(--home-stack-gap);
  align-items: stretch;   /* all cards in a row share the tallest card's height */
  max-width: 920px;       /* keep two-up cards a comfortable width, centred */
  margin-inline: auto;
}

/* A lone card (e.g. platinum has a single product) centres instead of sitting
   in the left grid column. Multi-card pages are unaffected. */
.product-cards__card:only-child {
  grid-column: 1 / -1;
  justify-self: center;
  width: 100%;
  max-width: 450px;
}

/* Zero-premium highlight: make the standout "0%" row pop in green. */
.product-cards__spec-row--free .product-cards__spec-label,
.product-cards__spec-row--free .product-cards__spec-value {
  background: rgba(52, 199, 89, 0.12);   /* pale tint of --green */
  color: #0b7a3b;                        /* readable dark green */
  font-weight: var(--fw-bold);
}

/* ---- Card ---- */
.product-cards__card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--cb-gap);
  padding: var(--redeem-step-pad);
  background: var(--gray-0);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-10);
}

/* ---- Card header: name + ticker chip ---- */
.product-cards__card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--cb-list-gap);
  /* reserve two title lines so single- and double-line names align the
     detail rows + spec tables across cards in the row */
  min-height: calc(var(--fs-20) * 3);
}
.product-cards__name {
  margin: 0;
  font-weight: var(--fw-semibold);
  font-size: var(--fs-20);
  line-height: normal;
  color: var(--gray-8);
  word-break: break-word;
}
.product-cards__ticker {
  flex: none;
  padding: var(--btn-pad-y) var(--btn-pad-x);
  background: var(--pale-blue);
  border-radius: var(--radius-4);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-12);
  line-height: normal;
  letter-spacing: 0.16px;
  color: var(--dusty-blue);
  text-transform: uppercase;
  white-space: nowrap;
}

/* ---- Flag + name group (left of the ticker chip) ---- */
.product-cards__head-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.product-cards__flag {
  flex: none;
  width: 40px;
  height: 40px;
  line-height: 0;
}
.product-cards__flag img {
  width: 100%;
  height: 100%;
  display: block;
}

/* ---- Vault / insurer detail rows ---- */
.product-cards__details {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--cb-list-gap);
}
.product-cards__detail {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--cb-list-gap);
}
.product-cards__detail-label {
  font-weight: var(--fw-regular);
  font-size: var(--fs-14);
  color: var(--color-text-muted);
}
.product-cards__detail-value {
  margin: 0;
  text-align: right;
  font-weight: var(--fw-semibold);
  font-size: var(--fs-14);
  color: var(--gray-8);
  word-break: break-word;
}

/* ---- Spec table (modelled on price-grids look) ---- */
.product-cards__spec {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-10);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.product-cards__spec-label,
.product-cards__spec-value {
  padding: 9px 8px;
  border-bottom: 1px solid var(--color-border);
}
.product-cards__spec-label {
  text-align: left;
  font-weight: var(--fw-semibold);
  color: var(--gray-7);
  white-space: nowrap;
}
.product-cards__spec-value {
  text-align: right;
  color: var(--gray-8);
  word-break: break-word;
}
/* Live + numeric cells use tabular figures so digits line up as they update. */
.product-cards__spec-value--figure {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.product-cards__spec-row--live .product-cards__spec-label,
.product-cards__spec-row--live .product-cards__spec-value {
  background: var(--pale-blue);
  color: var(--dusty-blue);
}
.product-cards__spec-row:last-child .product-cards__spec-label,
.product-cards__spec-row:last-child .product-cards__spec-value {
  border-bottom: 0;
}

/* ---- CTA pinned to the foot of the card ---- */
.product-cards__cta {
  margin-top: auto;
  align-self: stretch;
}

/* ---- Tablet/large-mobile/phone (<=767.98px): spec table scrollable ---- */
@media (max-width: 767.98px) {
  /* Spec table: allow horizontal scroll so it never clips the card at ~680px
     (vaulted-gold audit finding). display:block is needed for overflow-x on a <table>. */
  .product-cards__spec {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ---- Phone (<=599.98px): horizontal swipe carousel (scroll-snap) ---- */
/* NOTE: rules below are a byte-identical move from the former 767.98 block;
   the carousel now activates only on phone (<=599px). 600–1023 shows 2-up grid. */
@media (max-width: 599.98px) {
  .product-cards__grid {
    display: flex;
    grid-template-columns: none;
    max-width: none;
    margin-inline: calc(var(--pad-mobile) * -1);   /* full-bleed past the container gutter */
    padding-inline: var(--pad-mobile);
    overflow-x: auto;
    scroll-padding-inline: var(--pad-mobile);       /* don't glue the first card to the edge */
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .product-cards__grid::-webkit-scrollbar { display: none; }
  .product-cards__card {
    flex: 0 0 85%;                                   /* one card + a peek of the next */
    max-width: 85%;
    scroll-snap-align: start;
  }
  /* Lone card centres on mobile too (no horizontal-scroll peek needed). */
  .product-cards__card:only-child {
    flex: 0 0 auto;
    max-width: 100%;
    margin-inline: auto;
  }
  .product-cards__heading {
    font-size: clamp(24px, 6.4vw, var(--fs-32));
    line-height: 1.3;
  }
}
