/* css/pricing.css - Pricing page specific styles */

/* Keep horizontal overflow contained to local scroll areas on pricing page */
html.page-pricing,
body.page-pricing {
  overflow-x: clip;
}

/* Sticky pricing bar - hidden on mobile */
.sticky-pricing-bar {
  display: none;
}

@media (min-width: 768px) {
  .sticky-pricing-bar {
    display: block;
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--color-background);
    border-bottom: 1px solid var(--color-border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    padding: var(--space-lg) 0;
  }
}

.sticky-pricing-grid {
  display: grid;
  grid-template-columns: 20% repeat(4, 1fr);
  gap: 0;
  align-items: center;
}

@media (max-width: 1099px) {
  .sticky-pricing-grid {
    grid-template-columns: 160px repeat(4, 1fr);
  }
}

.sticky-pricing-tier {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-md);
  padding: 0 var(--space-md);
}

.sticky-pricing-tier-featured {
  /* No special background - keep it clean */
}

.sticky-tier-info {
  margin-bottom: var(--space-xs);
}

.sticky-pricing-tier .price-amount {
  font-size: inherit;
  line-height: inherit;
}

.sticky-tier-name {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: block;
  margin-bottom: var(--space-xs);
}

.sticky-tier-price {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.sticky-price-period {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-normal);
  color: var(--color-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: var(--font-size-sm);
  white-space: nowrap;
  min-height: 44px;
}

/* Button loading state */
.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

.btn:active:not([disabled],[aria-disabled="true"]) {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Hero section - match about page: same distance from header, same h1 size */
.hero-pricing {
  padding-top: var(--space-2xl);
  padding-bottom: var(--space-2xl);
}

.hero-pricing h1 {
  font-size: var(--font-size-4xl);
}

.hero-pricing .subtitle {
  font-size: clamp(1rem, 2.5vw, 1.125rem);
  max-width: 48rem;
  margin-left: auto;
  margin-right: auto;
}

/* Pricing cards section */
.pricing-cards-section {
  padding: var(--space-4xl) 0;
  background: var(--color-background-subtle);
}

.pricing-cards-section > .container {
  max-width: 1500px;
  padding-left: var(--space-xl);
  padding-right: var(--space-xl);
}

/* Billing toggle */
.billing-toggle-wrapper {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-2xl);
}

.billing-toggle {
  display: inline-flex;
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: 9999px;
  padding: 0.25rem;
  gap: 0.25rem;
  cursor: pointer;
  position: relative;
}

.billing-option {
  padding: 0.5rem 1.5rem;
  border-radius: 9999px;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  font-family: inherit;
  color: var(--color-text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  z-index: 1;
}

.billing-option[aria-checked="true"] {
  background: var(--color-primary);
  color: var(--color-primary-text);
}

.billing-option:hover {
  color: var(--color-text);
}

.billing-option[aria-checked="true"]:hover {
  color: var(--color-primary-text);
}

.billing-option:focus-visible {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: 2px;
}

/* Staggered reveal animation */
@media (prefers-reduced-motion: no-preference) {
  .pricing-card {
    opacity: 0;
    transform: translateY(20px);
    animation: reveal-card 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }

  .pricing-card:nth-child(1) {
    animation-delay: 0.1s;
  }

  .pricing-card:nth-child(2) {
    animation-delay: 0.2s;
  }

  .pricing-card:nth-child(3) {
    animation-delay: 0.3s;
  }

  .pricing-card:nth-child(4) {
    animation-delay: 0.4s;
  }

  @keyframes reveal-card {
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

.pricing-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl);
  margin-top: var(--space-2xl);
}

@media (min-width: 768px) {
  .pricing-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-lg);
    align-items: stretch;
  }
}

@media (min-width: 1400px) {
  .pricing-cards {
    grid-template-columns: repeat(4, minmax(280px, 1fr));
    gap: var(--space-lg);
    align-items: stretch;
  }
}

/* Pricing card */
.pricing-card {
  background: var(--color-background);
  border: 2px solid var(--color-border-subtle);
  border-radius: 1rem;
  padding: var(--space-xl);
  position: relative;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  height: 100%;
}

.pricing-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-large);
}

.pricing-card:focus-within {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .pricing-card {
    transition: none;
  }
  .pricing-card:hover {
    transform: none;
  }
}

/* Featured card with gradient border */
.pricing-card-featured {
  border: 2px solid transparent;
  background:
    linear-gradient(var(--color-background), var(--color-background)) padding-box,
    linear-gradient(135deg, #133a94 0%, #919bff 100%) border-box;
  box-shadow: var(--shadow-medium), 0 0 14px 3px rgba(145, 155, 255, 0.14);
}

@media (prefers-reduced-motion: no-preference) {
  .pricing-card-featured {
    /* Run reveal-card (nth-child 3 = 0.3s delay) alongside the glow, which starts after reveal finishes */
    animation-name: reveal-card, featured-glow;
    animation-duration: 0.6s, 3.5s;
    animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1), ease-in-out;
    animation-fill-mode: forwards, none;
    animation-iteration-count: 1, infinite;
    animation-delay: 0.3s, 0.9s;
  }

  @keyframes featured-glow {
    0%, 100% {
      box-shadow: var(--shadow-medium), 0 0 12px 3px rgba(145, 155, 255, 0.10);
    }
    50% {
      box-shadow: var(--shadow-medium), 0 0 26px 7px rgba(145, 155, 255, 0.22);
    }
  }
}

.pricing-card-featured:hover {
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Reduced motion: kill all animation, strip ambient glow, keep only structural shadows */
@media (prefers-reduced-motion: reduce) {
  .pricing-card-featured {
    animation: none !important;
    box-shadow: var(--shadow-medium);
  }

  .pricing-card-featured:hover {
    box-shadow: var(--shadow-medium);
  }
}

.pricing-card-badge {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #133a94 0%, #919bff 100%);
  color: white;
  padding: 0.375rem 1.25rem;
  border-radius: 9999px;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  white-space: nowrap;
  letter-spacing: 0.025em;
  box-shadow: 0 4px 6px -1px rgba(19, 58, 148, 0.3), 0 2px 4px -1px rgba(19, 58, 148, 0.2);
}

.savings-badge {
  background: linear-gradient(135deg, #133a94 0%, #919bff 100%);
  color: white;
  padding: 0.375rem 1rem;
  border-radius: 0.375rem;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
  margin-bottom: var(--space-sm);
  box-shadow: 0 4px 6px -1px rgba(19, 58, 148, 0.3), 0 2px 4px -1px rgba(19, 58, 148, 0.2);
}

/* Savings badge: closer to subhead above, further from price below */
.pricing-card .savings-badge {
  margin-top: 0;
  margin-bottom: var(--space-md);
}

/* No savings badge in Custom/Enterprise column; spacer matches badge height so CTAs align */
.pricing-card .savings-badge-spacer {
  min-height: calc(0.375rem * 2 + 1.5em);
  margin-bottom: var(--space-md);
}

.sticky-savings {
  font-size: 0.75rem;
  padding: 0.25rem 0.75rem;
  margin-bottom: var(--space-xs);
}

.sticky-savings-spacer {
  display: block;
  min-height: calc(0.75rem * 1.5 + 0.5rem);
  margin-bottom: var(--space-xs);
}

/* Card header - tight under subhead so badge/spacer sits close to description */
.pricing-card-header {
  margin-bottom: var(--space-sm);
}

.pricing-card-header h3 {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--space-xs);
  color: var(--color-text);
  font-family: var(--font-family-sans);
}

.pricing-card-description {
  color: var(--color-text-secondary);
  font-size: var(--font-size-base);
  line-height: 1.5;
  min-height: calc(1.5em * 2);
}

/* Price display */
.pricing-card-price {
  margin-bottom: var(--space-lg);
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.price-amount {
  font-size: clamp(2.5rem, 6vw, 3rem);
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.price-period {
  color: var(--color-text-secondary);
  font-size: var(--font-size-base);
}

.billed-note {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  font-weight: var(--font-weight-normal);
}

/* Reserve same space as "billed annually" line in Custom column so CTAs align */
.billed-note-spacer {
  display: block;
  min-height: 1.5em;
}

/* Button */
.btn-block {
  width: 100%;
  margin-bottom: var(--space-xl);
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Features list */
.pricing-card-features {
  flex: 1;
}

.pricing-card-features h4,
.pricing-card-features h5 {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-md);
}

.pricing-card-features ul {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-lg) 0;
}

.pricing-card-features ul li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: var(--space-sm);
  color: var(--color-text-secondary);
  font-size: var(--font-size-base);
  line-height: 1.7;
}

.feature-icon {
  color: var(--color-accent);
  font-weight: var(--font-weight-bold);
  flex-shrink: 0;
  font-size: 1.125rem;
}

/* Guidance section */
.pricing-card-guidance {
  margin-top: var(--space-lg);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--color-border-subtle);
}

.guidance-list {
  margin-top: var(--space-sm);
}

.guidance-list li {
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  line-height: 1.6;
}

/* Comparison section - no top padding so sticky bar sits flush at top */
.pricing-comparison-section {
  padding-top: 0;
  padding-bottom: var(--space-4xl);
  background: var(--color-background);
}

/* iOS Safari fix: force compositing layer to contain table scroll */
@media (max-width: 767px) {
  .pricing-table-wrapper {
    transform: translateZ(0);
  }
}

.pricing-comparison-section h2 {
  text-align: center;
  margin-top: var(--space-2xl);
  margin-bottom: var(--space-md);
  font-size: clamp(1.75rem, 4vw, 1.875rem);
}

.comparison-subtitle {
  text-align: center;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-3xl);
  max-width: 40rem;
  margin-left: auto;
  margin-right: auto;
  font-size: var(--font-size-base);
}

/* Table wrapper for horizontal scroll on mobile */
.pricing-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 calc(-1 * var(--space-md));
  padding: 0 var(--space-md);
}

@media (min-width: 768px) {
  .pricing-table-wrapper {
    margin: 0;
    padding: 0;
    overflow-x: visible;
  }
}

/* Pricing table */
.pricing-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 700px;
  background: var(--color-background);
  border: 1px solid var(--color-border-subtle);
  border-radius: 0.75rem;
  overflow: hidden;
  table-layout: fixed;
}

@media (min-width: 768px) {
  .pricing-table {
    min-width: 100%;
  }
}

.pricing-table col:first-child {
  width: 160px;
}

@media (min-width: 900px) {
  .pricing-table col:first-child {
    width: 20%;
  }
}

.pricing-table thead {
  background: var(--color-background-subtle);
}

.pricing-table thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--color-background-subtle);
  vertical-align: middle;
  padding: var(--space-lg) var(--space-md);
  text-align: center;
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
  font-size: var(--font-size-sm);
  border-bottom: 1px solid var(--color-border);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pricing-table thead th:first-child {
  text-align: left;
  padding-left: var(--space-lg);
}

.pricing-table tbody th {
  background: transparent;
  font-weight: var(--font-weight-medium);
  text-align: left;
  padding: var(--space-lg) var(--space-md);
  padding-left: var(--space-lg);
  color: var(--color-text);
  font-size: var(--font-size-base);
  border-bottom: 1px solid var(--color-border-subtle);
}

.pricing-table td {
  padding: var(--space-lg) var(--space-md);
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border-subtle);
  font-size: var(--font-size-base);
  text-align: center;
}

/* Alternating row backgrounds */
.pricing-table tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.01);
}

.pricing-table tbody tr:hover {
  background: rgba(0, 0, 0, 0.02);
}

.pricing-table tbody tr:last-child td,
.pricing-table tbody tr:last-child th {
  border-bottom: none;
}

.table-check {
  color: var(--color-accent);
  font-weight: var(--font-weight-bold);
  font-size: 1.25rem;
  display: inline-block;
}

.table-cross {
  color: var(--color-text-muted);
  font-size: 1.25rem;
  display: inline-block;
  opacity: 0.4;
}

/* Responsive table on mobile */
@media (max-width: 767px) {
  .pricing-table thead th {
    padding: var(--space-md) var(--space-sm);
    font-size: 0.6875rem;
  }

  .pricing-table thead th:first-child {
    padding-left: var(--space-md);
  }

  .pricing-table tbody th {
    padding: var(--space-md) var(--space-sm);
    padding-left: var(--space-md);
    font-size: var(--font-size-sm);
  }

  .pricing-table td {
    padding: var(--space-md) var(--space-sm);
    font-size: var(--font-size-sm);
  }

  .table-check,
  .table-cross {
    font-size: 1.125rem;
  }
}

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border-width: 0;
}

/* Skip link for keyboard users */
.skip-link:focus {
  position: fixed;
  top: var(--space-md);
  left: var(--space-md);
  z-index: 9999;
  background: var(--color-primary);
  color: var(--color-primary-text);
  padding: var(--space-sm) var(--space-md);
  border-radius: 0.25rem;
  text-decoration: none;
  box-shadow: var(--shadow-large);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .pricing-card {
    border-width: 3px;
  }

  .pricing-card-featured {
    border-width: 4px;
    /* Replace gradient border with a solid high-contrast border so it's visible */
    background: var(--color-background);
    border-color: currentcolor;
    box-shadow: none;
  }

  .pricing-card-featured:hover {
    box-shadow: none;
  }

  .table-check,
  .table-cross {
    font-weight: var(--font-weight-bold);
  }
}

/* Windows forced-colors / high-contrast mode */
@media (forced-colors: active) {
  .pricing-card-featured {
    border: 4px solid Highlight;
    background: Canvas;
    box-shadow: none;
    animation: none;
  }

  .pricing-card-badge,
  .savings-badge {
    background: Highlight;
    color: HighlightText;
    forced-color-adjust: none;
  }
}
