/* ==========================================================================
   Pricing Table Component
   Mobile-first — stacked on mobile, 3-column grid on desktop.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Section wrapper
   -------------------------------------------------------------------------- */
.pricing-table {
  padding-block: var(--space-8);
  background-color: var(--color-surface-secondary);
}

/* --------------------------------------------------------------------------
   Section header
   -------------------------------------------------------------------------- */
.pricing-table__header {
  text-align: center;
  margin-block-end: var(--space-7);
}

.pricing-table__heading {
  font-family: var(--font-family-heading);
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  color: var(--color-text-primary);
  margin-block-end: var(--space-3);
}

.pricing-table__subheading {
  font-family: var(--font-family-body);
  font-size: var(--font-size-lg);
  color: var(--color-text-secondary);
  line-height: var(--line-height-normal);
  max-width: var(--max-width-narrow);
  margin-inline: auto;
}

/* --------------------------------------------------------------------------
   Grid — mobile: single column; tablet: 2 columns; desktop: 3 columns
   -------------------------------------------------------------------------- */
.pricing-table__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6); /* gap-6 = --space-6 = 32px */
  align-items: start;  /* let the recommended card scale without clipping siblings */
}

@media (min-width: 768px) {
  .pricing-table__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .pricing-table__grid {
    grid-template-columns: repeat(3, 1fr);
    /* vertically center all cards so scale(1.05) on the middle card looks balanced */
    align-items: center;
  }
}

/* --------------------------------------------------------------------------
   Card base
   -------------------------------------------------------------------------- */
.pricing-table__card {
  position: relative;       /* anchor for the "Most Popular" badge */
  display: flex;
  flex-direction: column;
  background-color: var(--color-surface-primary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: var(--space-7) var(--space-6);
  transition: box-shadow var(--transition-normal);
}

.pricing-table__card:hover {
  box-shadow: var(--shadow-lg);
}

/* --------------------------------------------------------------------------
   Recommended card — highlighted middle tier
   -------------------------------------------------------------------------- */
.pricing-table__card--recommended {
  border-top: 4px solid var(--color-brand-primary);
  /* Offset the extra 4px top border so interior spacing stays visually even */
  padding-block-start: calc(var(--space-7) - 4px);
  transform: scale(1.05);
  /* Lift above sibling cards so shadows aren't obscured */
  z-index: 1;
  /* Override base shadow with a stronger elevation cue */
  box-shadow: var(--shadow-lg);
}

.pricing-table__card--recommended:hover {
  filter: brightness(0.98);
}

/* --------------------------------------------------------------------------
   "Most Popular" badge
   -------------------------------------------------------------------------- */
.pricing-table__badge {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  background-color: var(--color-brand-primary);
  color: var(--color-text-inverse);
  font-family: var(--font-family-body);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  line-height: 1;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  white-space: nowrap;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Plan name
   -------------------------------------------------------------------------- */
.pricing-table__plan-name {
  font-family: var(--font-family-heading);
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
  line-height: var(--line-height-tight);
  margin-block-end: var(--space-4);
  /* Prevent long plan names from colliding with the badge */
  padding-inline-end: var(--space-8);
}

/* --------------------------------------------------------------------------
   Price
   -------------------------------------------------------------------------- */
.pricing-table__price-wrap {
  display: flex;
  align-items: baseline;
  gap: var(--space-1);
  margin-block-end: var(--space-4);
}

.pricing-table__currency {
  font-family: var(--font-family-heading);
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-brand-primary);
  line-height: 1;
}

.pricing-table__amount {
  font-family: var(--font-family-heading);
  font-size: var(--font-size-4xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-brand-primary);
  line-height: 1;
}

.pricing-table__period {
  font-family: var(--font-family-body);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  color: var(--color-text-secondary);
  line-height: 1;
}

/* --------------------------------------------------------------------------
   Description
   -------------------------------------------------------------------------- */
.pricing-table__description {
  font-family: var(--font-family-body);
  font-size: var(--font-size-base);
  color: var(--color-text-secondary);
  line-height: var(--line-height-normal);
  margin-block-end: var(--space-5);
}

/* --------------------------------------------------------------------------
   Divider
   -------------------------------------------------------------------------- */
.pricing-table__divider {
  border: none;
  border-top: 1px solid var(--color-border-subtle);
  margin-block: 0 var(--space-5);
}

/* --------------------------------------------------------------------------
   Feature list
   -------------------------------------------------------------------------- */
.pricing-table__features {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  /* flex: 1 causes this element to grow and push the CTA to the card bottom */
  flex: 1;
  margin-block-end: var(--space-6);
}

.pricing-table__feature {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  font-family: var(--font-family-body);
  font-size: var(--font-size-base);
  color: var(--color-text-primary);
  line-height: var(--line-height-normal);
}

/* Green checkmark icon */
.pricing-table__check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--color-status-success);
  /* Nudge icon baseline to align with the first line of text */
  margin-block-start: 2px;
}

/* --------------------------------------------------------------------------
   CTA button wrapper — always at the bottom of the card
   -------------------------------------------------------------------------- */
.pricing-table__cta {
  margin-block-start: auto;
}

/*
   Ensure any rendered cta-button fills the full card width.
   Target both <a> and <button> elements that the parent theme may emit,
   without depending on knowledge of the component's internal markup.
*/
.pricing-table__cta .cta-button,
.pricing-table__cta a[class*="cta-button"],
.pricing-table__cta button[class*="cta-button"] {
  display: block;
  width: 100%;
  text-align: center;
}

/* --------------------------------------------------------------------------
   Reduced-motion: honour the user's OS preference
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .pricing-table__card--recommended {
    transform: none;
  }

  .pricing-table__card {
    transition: none;
  }
}
