/* ═══════════════════════════════════════════════
   CASTHEVENS — WooCommerce SaaS pricing section
   Glass cards · billing toggle · comparison · FAQ
   Theming: [data-theme="dark" | "light" | "auto"]
═══════════════════════════════════════════════ */

/* ── Tokens (dark is the default, matching the theme) ── */
.pricing-saas {
  --pr-accent:      var(--gold, #d4af37);
  --pr-accent-hi:   var(--gold-hi, #f0d060);
  --pr-bg:          transparent;
  --pr-text:        var(--mist, #fafafa);
  --pr-muted:       #9a9a9a;
  --pr-card:        rgba(255, 255, 255, 0.035);
  --pr-card-line:   rgba(255, 255, 255, 0.09);
  --pr-glass-blur:  14px;
  --pr-shadow:      0 24px 60px rgba(0, 0, 0, 0.45);
  --pr-row-line:    rgba(255, 255, 255, 0.07);
  --pr-ease:        var(--ease, cubic-bezier(0.22, 1, 0.36, 1));
}

.pricing-saas[data-theme="light"] {
  --pr-text:      #17181c;
  --pr-muted:     #5c6066;
  --pr-card:      rgba(255, 255, 255, 0.65);
  --pr-card-line: rgba(23, 24, 28, 0.1);
  --pr-shadow:    0 24px 60px rgba(23, 24, 28, 0.12);
  --pr-row-line:  rgba(23, 24, 28, 0.08);
}
@media (prefers-color-scheme: light) {
  .pricing-saas[data-theme="auto"] {
    --pr-text:      #17181c;
    --pr-muted:     #5c6066;
    --pr-card:      rgba(255, 255, 255, 0.65);
    --pr-card-line: rgba(23, 24, 28, 0.1);
    --pr-shadow:    0 24px 60px rgba(23, 24, 28, 0.12);
    --pr-row-line:  rgba(23, 24, 28, 0.08);
  }
}

/* ── Section shell ── */
.pricing-saas {
  background: var(--pr-bg);
  color: var(--pr-text);
  padding: 40px 0 120px;
}
.pr-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
}
@media (min-width: 640px) { .pr-container { padding: 0 40px; } }

.pr-head { padding: 56px 0 40px; max-width: 720px; }
.pr-eyebrow {
  display: inline-block;
  color: var(--pr-accent);
  font-size: 12px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  margin-bottom: 20px;
}
.pr-head-sub { color: var(--pr-muted); font-size: 15px; line-height: 1.8; margin-top: 24px; }

.pr-sub-title {
  font-size: clamp(24px, 3vw, 34px);
  margin: 0 0 32px;
  color: var(--pr-text);
}

/* ── Billing toggle ── */
.pr-toggle {
  position: relative;
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--pr-card-line);
  border-radius: 999px;
  background: var(--pr-card);
  -webkit-backdrop-filter: blur(var(--pr-glass-blur));
  backdrop-filter: blur(var(--pr-glass-blur));
  padding: 5px;
  margin: 0 0 48px;
  isolation: isolate;
}
.pr-toggle-opt {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 26px;
  border-radius: 999px;
  color: var(--pr-muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: color 0.35s var(--pr-ease);
}
.pr-toggle-opt.is-active { color: #000; }
.pr-toggle-opt:focus-visible { outline: 2px solid var(--pr-accent); outline-offset: 2px; }
.pr-toggle-save {
  font-style: normal;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(0, 128, 64, 0.18);
  color: #35c47c;
}
.pr-toggle-opt.is-active .pr-toggle-save { background: rgba(0, 0, 0, 0.22); color: #063; }
/* Sliding thumb: moves right when the second option is active */
.pr-toggle-thumb {
  position: absolute;
  inset: 5px calc(50% + 0px) 5px 5px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--pr-accent-hi), var(--pr-accent));
  transition: inset 0.45s var(--pr-ease);
}
.pr-toggle.is-yearly .pr-toggle-thumb { inset: 5px 5px 5px calc(50% + 0px); }

/* ── Cards grid (equal heights via stretch + flex column) ── */
.pr-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: stretch;
}
@media (min-width: 720px)  { .pr-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1200px) { .pr-grid { grid-template-columns: repeat(4, 1fr); gap: 24px; } }

.pr-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  border: 1px solid var(--pr-card-line);
  background: var(--pr-card);
  -webkit-backdrop-filter: blur(var(--pr-glass-blur)) saturate(140%);
  backdrop-filter: blur(var(--pr-glass-blur)) saturate(140%);
  padding: 36px 28px 32px;
  transition: transform 0.5s var(--pr-ease), box-shadow 0.5s var(--pr-ease);
}
/* Gradient border, revealed on hover */
.pr-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 21px;
  padding: 1px;
  background: linear-gradient(140deg, var(--pr-accent-hi), transparent 40%, transparent 60%, var(--pr-accent));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.5s var(--pr-ease);
  pointer-events: none;
}
.pr-card:hover { transform: translateY(-8px); box-shadow: var(--pr-shadow); }
.pr-card:hover::before { opacity: 1; }

/* Featured (Most Popular) card */
.pr-card--featured {
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.12), rgba(212, 175, 55, 0.03) 55%), var(--pr-card);
  border-color: rgba(212, 175, 55, 0.4);
}
.pr-card--featured::before { opacity: 0.6; }
@media (min-width: 1200px) {
  .pr-card--featured { transform: scale(1.04); z-index: 1; }
  .pr-card--featured:hover { transform: scale(1.04) translateY(-8px); }
}
.pr-badge {
  position: absolute;
  top: -13px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  padding: 6px 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--pr-accent-hi), var(--pr-accent));
  color: #000;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  box-shadow: 0 8px 24px rgba(212, 175, 55, 0.35);
}

.pr-card-title { font-size: 22px; margin: 0 0 6px; color: var(--pr-text); }
.pr-card-tagline { color: var(--pr-muted); font-size: 13px; line-height: 1.6; margin: 0 0 26px; min-height: 2.6em; }

/* ── Price block ── */
.pr-price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; margin-bottom: 26px; min-height: 56px; }
.pr-price-old { color: var(--pr-muted); text-decoration: line-through; font-size: 16px; }
.pr-price-now { display: inline-flex; align-items: baseline; gap: 4px; }
.pr-price-amount {
  font-family: var(--serif, Georgia, serif);
  font-size: clamp(36px, 4vw, 44px);
  font-weight: 400;
  line-height: 1;
  color: var(--pr-text);
  font-variant-numeric: tabular-nums;
}
.pr-price-period { color: var(--pr-muted); font-size: 13px; }
.pr-price-save {
  align-self: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 128, 64, 0.18);
  color: #35c47c;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.pr-price-soon {
  font-family: var(--serif, Georgia, serif);
  font-size: 28px;
  font-style: italic;
  color: var(--pr-muted);
}

/* ── Features list (grows to equalize card heights) ── */
.pr-features { list-style: none; margin: 0 0 28px; padding: 22px 0 0; border-top: 1px solid var(--pr-row-line); flex: 1; }
.pr-features li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--pr-text);
  font-size: 13.5px;
  line-height: 1.5;
  padding: 6px 0;
}
.pr-check { width: 15px; height: 15px; flex: none; margin-top: 3px; color: var(--pr-accent); }

/* ── CTA button ── */
.pr-btn {
  display: block;
  text-align: center;
  padding: 14px 20px;
  border-radius: 12px;
  border: 1px solid var(--pr-card-line);
  color: var(--pr-text);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: background 0.35s var(--pr-ease), color 0.35s var(--pr-ease), border-color 0.35s var(--pr-ease), transform 0.35s var(--pr-ease);
}
.pr-btn:hover { border-color: var(--pr-accent); background: rgba(212, 175, 55, 0.08); transform: translateY(-2px); }
.pr-btn:focus-visible { outline: 2px solid var(--pr-accent); outline-offset: 3px; }
.pr-card--featured .pr-btn {
  background: linear-gradient(135deg, var(--pr-accent-hi), var(--pr-accent));
  border-color: transparent;
  color: #000;
}
.pr-card--featured .pr-btn:hover { filter: brightness(1.08); }
.pr-btn--disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

/* ── Trust line ── */
.pr-trust {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 32px;
  justify-content: center;
  margin: 40px 0 0;
  color: var(--pr-muted);
  font-size: 13px;
}

/* ── Comparison table ── */
.pr-compare { margin-top: 96px; }
.pr-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--pr-card-line);
  border-radius: 16px;
  background: var(--pr-card);
  -webkit-backdrop-filter: blur(var(--pr-glass-blur));
  backdrop-filter: blur(var(--pr-glass-blur));
}
.pr-table-wrap:focus-visible { outline: 2px solid var(--pr-accent); outline-offset: 2px; }
.pr-table { width: 100%; min-width: 720px; border-collapse: collapse; font-size: 13.5px; }
.pr-table th,
.pr-table td { padding: 14px 20px; border-bottom: 1px solid var(--pr-row-line); }
.pr-table tbody tr:last-child th,
.pr-table tbody tr:last-child td { border-bottom: 0; }
.pr-table thead th {
  color: var(--pr-accent);
  font-size: 12px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-align: left;
  padding-top: 20px;
  padding-bottom: 20px;
}
.pr-table tbody th { text-align: left; font-weight: 500; color: var(--pr-text); }
.pr-table td { color: var(--pr-muted); }
.pr-table td .pr-check { margin: 0; }
.pr-dash { opacity: 0.4; }
.pr-table tbody tr { transition: background 0.25s var(--pr-ease); }
.pr-table tbody tr:hover { background: rgba(212, 175, 55, 0.045); }

/* ── FAQ accordion ── */
.pr-faq { margin-top: 96px; max-width: 860px; }
.pr-faq-item { border-bottom: 1px solid var(--pr-row-line); }
.pr-faq-q {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 4px;
  color: var(--pr-text);
  font-size: 16px;
  font-weight: 500;
  text-align: left;
  transition: color 0.3s var(--pr-ease);
}
.pr-faq-q:hover,
.pr-faq-q[aria-expanded="true"] { color: var(--pr-accent); }
.pr-faq-q:focus-visible { outline: 2px solid var(--pr-accent); outline-offset: 2px; }
.pr-faq-q i {
  font-style: normal;
  font-size: 20px;
  line-height: 1;
  flex: none;
  transition: transform 0.4s var(--pr-ease);
}
.pr-faq-q[aria-expanded="true"] i { transform: rotate(45deg); }
.pr-faq-a { overflow: hidden; }
.pr-faq-a p { color: var(--pr-muted); font-size: 14px; line-height: 1.9; margin: 0; padding: 0 4px 24px; max-width: 64ch; }

/* ── Scroll reveal (opacity/transform only — safe for IntersectionObserver) ── */
.pr-reveal { opacity: 0; transform: translateY(36px); transition: opacity 0.8s var(--pr-ease), transform 0.8s var(--pr-ease); }
.pr-reveal.in-view { opacity: 1; transform: none; }
@media (min-width: 1200px) {
  .pr-card--featured.pr-reveal { transform: scale(1.04) translateY(36px); }
  .pr-card--featured.pr-reveal.in-view { transform: scale(1.04); }
}
/* Stagger the four cards */
.pr-grid .pr-card:nth-child(2) { transition-delay: 0.08s; }
.pr-grid .pr-card:nth-child(3) { transition-delay: 0.16s; }
.pr-grid .pr-card:nth-child(4) { transition-delay: 0.24s; }

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .pr-reveal,
  .pr-card,
  .pr-toggle-thumb,
  .pr-btn,
  .pr-faq-q i { transition: none !important; }
  .pr-reveal { opacity: 1; transform: none; }
  .pr-card--featured.pr-reveal { transform: scale(1.04); }
}
