/* =============================================================
   PLANS PAGE — Apple liquid glass + rotating accent gradients
   Editable copy lives in Firestore (config/plans).
   ============================================================= */

.page-plans {
  background: var(--color-bg);
}

.plans-page {
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 4rem) clamp(1rem, 3vw, 2rem) clamp(3rem, 6vw, 5rem);
  position: relative;
  z-index: 1;
}

/* ── HERO ─────────────────────────────────────────────────────── */
.plans-hero {
  text-align: center;
  max-width: 44rem;
  margin: 0 auto clamp(2rem, 5vw, 3.5rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
}

.plans-hero__eyebrow {
  margin: 0;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--color-accent);
  text-shadow: 0 1px 14px rgba(100, 210, 255, 0.35);
}

.plans-hero__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.04;
  text-wrap: balance;
  background: linear-gradient(180deg, var(--color-text) 0%, rgba(255, 255, 255, 0.7) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.plans-hero__lead {
  margin: 0;
  font-size: clamp(1rem, 1.4vw, 1.125rem);
  line-height: 1.55;
  color: var(--color-text-muted);
  letter-spacing: -0.01em;
  max-width: 36rem;
}

/* ── GRID ─────────────────────────────────────────────────────── */
.plans-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  align-items: stretch;
  margin: 0 auto;
}

@media (max-width: 1080px) {
  .plans-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
  }
}

@media (max-width: 600px) {
  .plans-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }
}

/* ── REVEAL ───────────────────────────────────────────────────── */
[data-plan-reveal] {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 760ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 760ms cubic-bezier(0.16, 1, 0.3, 1);
}

[data-plan-reveal].is-in {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  [data-plan-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ── PLAN CARD ────────────────────────────────────────────────── */
.plan-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-height: clamp(22.5rem, 34vw, 26.5rem);
  padding: 2rem 1.5rem 1.75rem;
  border-radius: 1.5rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045) 0%, rgba(255, 255, 255, 0.012) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(32px) saturate(150%);
  -webkit-backdrop-filter: blur(32px) saturate(150%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 18px 48px rgba(0, 0, 0, 0.32);
  overflow: hidden;
  isolation: isolate;
  transition:
    transform 460ms cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 460ms cubic-bezier(0.16, 1, 0.3, 1),
    border-color 320ms ease;
  --plan-mx: 50%;
  --plan-my: 50%;
}

.plan-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: radial-gradient(
    220px circle at var(--plan-mx) var(--plan-my),
    rgba(100, 210, 255, 0.16),
    transparent 70%
  );
  opacity: 0;
  transition: opacity 320ms ease;
  pointer-events: none;
  z-index: -1;
}

.plan-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 24px 64px rgba(0, 0, 0, 0.42);
}

.plan-card:hover::before {
  opacity: 1;
}

/* Highlighted (most popular / best value) variant */
.plan-card--highlight {
  border-color: rgba(100, 210, 255, 0.32);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 22px 60px rgba(0, 0, 0, 0.38),
    0 0 0 1px rgba(100, 210, 255, 0.22);
}

.plan-card--highlight:hover {
  border-color: rgba(100, 210, 255, 0.45);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 28px 72px rgba(0, 0, 0, 0.46),
    0 0 0 1px rgba(100, 210, 255, 0.32);
}

/* Badge — top-right pill */
.plan-card__badge--empty:empty {
  display: none;
}

.plan-card__badge {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  font-size: 0.5625rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-secondary, #bf5af2) 100%);
  color: #0a0a0c;
  box-shadow:
    0 6px 16px rgba(100, 210, 255, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.32);
  z-index: 2;
}

/* Head: label / price / period */
.plan-card__head {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.plan-card__label {
  margin: 0;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.plan-card__price {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.038em;
  line-height: 1.02;
  color: var(--color-text);
}

.plan-card__period {
  margin: 0;
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

/* Features list */
.plan-card__features {
  margin: 0;
  padding: 0.25rem 0 0.5rem;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  flex: 1;
}

.plan-card__features li {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--color-text-secondary);
  letter-spacing: -0.005em;
}

.plan-card__check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 2px;
  border-radius: 50%;
  background: rgba(100, 210, 255, 0.16);
  color: var(--color-accent);
}

/* CTA — gradient rotating accent border */
.plan-card__cta {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  margin-top: auto;
  min-height: 44px;
  padding: 0.65rem 1.2rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.05);
  color: var(--color-text);
  font-weight: 600;
  letter-spacing: -0.01em;
  font-size: 0.9375rem;
  text-decoration: none;
  overflow: hidden;
  isolation: isolate;
  transition:
    transform 220ms cubic-bezier(0.32, 0.72, 0, 1),
    background 220ms ease,
    border-color 220ms ease,
    box-shadow 220ms ease;
}

.plan-card__cta::before {
  content: "";
  position: absolute;
  inset: -200%;
  border-radius: inherit;
  background: conic-gradient(
    from 0deg,
    var(--color-accent) 0deg,
    var(--color-accent-secondary, #bf5af2) 100deg,
    #ff6482 200deg,
    var(--color-accent) 360deg
  );
  opacity: 0;
  z-index: -1;
  animation: plan-cta-spin 6s linear infinite;
  transition: opacity 320ms ease;
}

.plan-card__cta::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  background: rgba(14, 14, 20, 0.94);
  z-index: -1;
  transition: background 220ms ease;
}

.plan-card__cta:hover {
  border-color: transparent;
  transform: translateY(-1px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

.plan-card__cta:hover::before {
  opacity: 1;
}

.plan-card__cta:active {
  transform: scale(0.97);
}

.plan-card__cta-arrow {
  transition: transform 220ms cubic-bezier(0.32, 0.72, 0, 1);
}

.plan-card__cta:hover .plan-card__cta-arrow {
  transform: translateX(3px);
}

/* Highlighted CTA always shows the rotating gradient (calm) */
.plan-card--highlight .plan-card__cta::before {
  opacity: 0.85;
}

.plan-card--highlight .plan-card__cta {
  border-color: transparent;
  color: #fff;
}

.plan-card--highlight .plan-card__cta:hover::before {
  opacity: 1;
}

@keyframes plan-cta-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .plan-card__cta::before { animation: none; }
}

/* ── FOOTNOTE ─────────────────────────────────────────────────── */
.plans-footnote {
  margin: clamp(2rem, 4vw, 3rem) auto 0;
  max-width: 38rem;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--color-text-subtle);
  line-height: 1.5;
}

.plans-footnote p {
  margin: 0;
}

/* ── Free card: keep a CURRENT-state look ─────────────────────── */
.plan-card--free .plan-card__cta {
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-text-secondary);
}

.plan-card--free .plan-card__cta::before {
  display: none;
}

.plan-card--free .plan-card__cta::after {
  background: rgba(255, 255, 255, 0.04);
}

/* ── LIGHT THEME ──────────────────────────────────────────────── */
html[data-theme="light"] .plans-hero__title {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.92) 0%, rgba(0, 0, 0, 0.55) 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

html[data-theme="light"] .plan-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.7) 100%);
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 18px 48px rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .plan-card:hover {
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow:
    inset 0 1px 0 #fff,
    0 24px 64px rgba(0, 0, 0, 0.1);
}

html[data-theme="light"] .plan-card--highlight {
  border-color: rgba(0, 122, 255, 0.35);
  box-shadow:
    inset 0 1px 0 #fff,
    0 22px 60px rgba(0, 0, 0, 0.08),
    0 0 0 1px rgba(0, 122, 255, 0.25);
}

html[data-theme="light"] .plan-card__head {
  border-bottom-color: rgba(0, 0, 0, 0.06);
}

html[data-theme="light"] .plan-card__check {
  background: rgba(0, 122, 255, 0.12);
  color: #007aff;
}

html[data-theme="light"] .plan-card__cta {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.1);
  color: rgba(0, 0, 0, 0.86);
}

html[data-theme="light"] .plan-card__cta::after {
  background: #ffffff;
}

html[data-theme="light"] .plan-card--free .plan-card__cta {
  background: rgba(0, 0, 0, 0.05);
  color: rgba(0, 0, 0, 0.62);
}

html[data-theme="light"] .plans-hero__eyebrow {
  color: #007aff;
  text-shadow: none;
}

html[data-theme="light"] .plan-card__badge {
  background: linear-gradient(135deg, #007aff 0%, #bf5af2 100%);
  color: #ffffff;
  box-shadow:
    0 6px 16px rgba(0, 122, 255, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* ── SAFE-AREA for mobile bottom bars ─────────────────────────── */
@media (max-width: 720px) {
  .plans-page {
    padding-bottom: calc(3rem + env(safe-area-inset-bottom, 0px));
  }
}

/* ===============================================================
   PLANS POLISH PASS — premium card refinements
   =============================================================== */

/* Page background — match index aesthetic */
.page-plans {
  background: #07070b !important;
  background-image:
    radial-gradient(ellipse 80% 50% at 80% -10%, rgba(100,210,255,0.14), transparent 55%),
    radial-gradient(ellipse 70% 55% at 10% 10%, rgba(150,120,255,0.10), transparent 55%),
    radial-gradient(ellipse 90% 50% at 50% 110%, rgba(255,120,180,0.07), transparent 60%) !important;
}

/* Plans hero — gradient title */
.plans-hero__title {
  background: linear-gradient(160deg, #fff 0%, rgba(100,210,255,0.88) 100%) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  font-size: clamp(2.2rem, 5vw, 4rem) !important;
  font-weight: 800 !important;
  letter-spacing: -0.045em !important;
}

.plans-hero__eyebrow {
  font-size: 0.7rem !important;
  letter-spacing: 0.35em !important;
  text-shadow: 0 0 20px rgba(100,210,255,0.5) !important;
}

.plans-hero__lead {
  font-size: clamp(1rem, 1.5vw, 1.15rem) !important;
  color: rgba(255,255,255,0.65) !important;
}

/* Card size — more room */
.plan-card {
  min-height: clamp(25rem, 38vw, 30rem) !important;
  padding: 2.2rem 1.75rem 2rem !important;
  border-radius: 20px !important;
}

/* Label — accent per tier */
.plan-card:nth-child(1) .plan-card__label { color: rgba(255,255,255,0.52) !important; }
.plan-card:nth-child(2) .plan-card__label { color: rgba(100,210,255,0.85) !important; }
.plan-card:nth-child(3) .plan-card__label { color: rgba(150,120,255,0.85) !important; }
.plan-card:nth-child(4) .plan-card__label { color: rgba(255,180,80,0.85) !important; }

/* Price — gradient per tier */
.plan-card__price {
  font-size: clamp(2.2rem, 4.5vw, 3rem) !important;
  font-weight: 800 !important;
  letter-spacing: -0.045em !important;
}

.plan-card:nth-child(2) .plan-card__price {
  background: linear-gradient(135deg, #fff 0%, rgba(100,210,255,0.9) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.plan-card:nth-child(3) .plan-card__price {
  background: linear-gradient(135deg, #fff 0%, rgba(150,120,255,0.9) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.plan-card:nth-child(4) .plan-card__price {
  background: linear-gradient(135deg, #fff 0%, rgba(255,180,80,0.9) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Feature items */
.plan-card__features li {
  font-size: 0.88rem !important;
  color: rgba(255,255,255,0.72) !important;
  gap: 0.6rem !important;
}

/* Checkmark per tier color */
.plan-card:nth-child(2) .plan-card__check {
  background: rgba(100,210,255,0.16) !important;
  color: rgb(100,210,255) !important;
}
.plan-card:nth-child(3) .plan-card__check {
  background: rgba(150,120,255,0.16) !important;
  color: rgb(150,120,255) !important;
}
.plan-card:nth-child(4) .plan-card__check {
  background: rgba(255,180,80,0.16) !important;
  color: rgb(255,180,80) !important;
}

/* CTA button — more prominent */
.plan-card__cta {
  min-height: 48px !important;
  font-weight: 700 !important;
  letter-spacing: 0.02em !important;
  font-size: 0.875rem !important;
  border-radius: 12px !important;
}

/* Highlighted card — stronger ring */
.plan-card--highlight {
  border-color: rgba(100,210,255,0.35) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.14),
    0 32px 80px rgba(0,0,0,0.42),
    0 0 0 1px rgba(100,210,255,0.22),
    0 0 60px rgba(100,210,255,0.08) !important;
}

/* Card top accent bar */
.plan-card:nth-child(2)::before {
  background: linear-gradient(90deg, transparent, rgba(100,210,255,0.65), transparent) !important;
  height: 1.5px !important;
  inset: 0 !important;
  top: 0 !important;
  bottom: auto !important;
  border-radius: inherit !important;
  opacity: 1 !important;
}

.plan-card:nth-child(3)::before {
  background: linear-gradient(90deg, transparent, rgba(150,120,255,0.65), transparent) !important;
  height: 1.5px !important;
  inset: 0 !important;
  top: 0 !important;
  bottom: auto !important;
  border-radius: inherit !important;
  opacity: 1 !important;
}

.plan-card:nth-child(4)::before {
  background: linear-gradient(90deg, transparent, rgba(255,180,80,0.55), transparent) !important;
  height: 1.5px !important;
  inset: 0 !important;
  top: 0 !important;
  bottom: auto !important;
  border-radius: inherit !important;
  opacity: 1 !important;
}

/* Plan grid entrance animation */
@keyframes plan-card-in {
  from { opacity: 0; transform: translateY(32px) scale(0.97); filter: blur(4px); }
  to   { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

.plans-grid {
  animation: plan-card-in 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.15s both;
}

.plan-card:nth-child(1) { animation: plan-card-in 0.5s cubic-bezier(0.16,1,0.3,1) 0.10s both; }
.plan-card:nth-child(2) { animation: plan-card-in 0.5s cubic-bezier(0.16,1,0.3,1) 0.18s both; }
.plan-card:nth-child(3) { animation: plan-card-in 0.5s cubic-bezier(0.16,1,0.3,1) 0.26s both; }
.plan-card:nth-child(4) { animation: plan-card-in 0.5s cubic-bezier(0.16,1,0.3,1) 0.34s both; }

@media (prefers-reduced-motion: reduce) {
  .plans-grid, .plan-card { animation: none !important; }
}

/* Light theme */
html[data-theme="light"] .page-plans {
  background: #f4f5fb !important;
  background-image:
    radial-gradient(ellipse 80% 50% at 80% -10%, rgba(0,100,220,0.08), transparent 55%) !important;
}

html[data-theme="light"] .plans-hero__title {
  background: linear-gradient(160deg, #0a1a40, #0b67c8) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
}

/* =================================================================
   MOBILE — plan cards stack, so drop the desktop equal-height min so
   each card is content-sized (no forced empty space under features).
   ================================================================= */
@media (max-width: 600px) {
  .plan-card {
    min-height: 0 !important;
    padding: 1.5rem 1.4rem 1.3rem !important;
  }
  .plan-card__features {
    flex: 0 0 auto !important;
  }
  .plan-card__cta {
    margin-top: 1.1rem !important;
  }
  /* Tighter hero on mobile */
  .plans-page {
    padding-top: clamp(1.5rem, 5vw, 2.5rem) !important;
  }
}
