/* ==========================================================================
   Tavern — Royal Membership Plans Stylesheet
   Companion to landing.css (inherits its tokens, nav, buttons, footer)
   Page: client/plans.html — subscription tiers from src/shop/plans.json
   ========================================================================== */

/* ==========================================================================
   Nav — current page indicator
   ========================================================================== */
.nav-links a.active {
  color: var(--accent-gold-light);
  font-weight: 700;
}

/* ==========================================================================
   Hero
   ========================================================================== */
.plans-hero {
  padding: 76px 0 100px;
  position: relative;
  text-align: center;
}

.plans-hero .hero-pill {
  margin-bottom: 22px;
}

.plans-hero .hero-subtitle {
  max-width: 660px;
  margin-bottom: 0;
}

/* ==========================================================================
   Billing Cycle Toggle (Monthly / Yearly)
   ========================================================================== */
.billing-toggle-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 40px 0 54px;
}

.billing-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px;
  background: rgba(18, 15, 26, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-card);
}

.billing-slider {
  position: absolute;
  top: 5px;
  bottom: 5px;
  left: 5px;
  width: 0;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--accent-amber) 0%, var(--accent-gold) 50%, var(--accent-gold-light) 100%);
  box-shadow: 0 3px 16px rgba(245, 158, 11, 0.45), inset 0 1px 1px rgba(255, 255, 255, 0.55);
  transition: left 0.32s cubic-bezier(0.16, 1, 0.3, 1), width 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  visibility: hidden;
  pointer-events: none;
}

.billing-toggle.is-ready .billing-slider {
  visibility: visible;
}

.billing-option {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 11px 28px;
  border: none;
  background: transparent;
  border-radius: var(--radius-full);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.25s ease;
  -webkit-user-select: none;
  user-select: none;
}

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

.billing-option.active {
  color: #110e08;
  font-weight: 800;
}

.billing-option.active:hover {
  color: #110e08;
}

.billing-save {
  padding: 2px 9px;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(16, 185, 129, 0.45);
  color: #34d399;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  white-space: nowrap;
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

.billing-option.active .billing-save {
  background: rgba(6, 42, 27, 0.85);
  border-color: rgba(6, 42, 27, 0.9);
  color: #6ee7b7;
}

.billing-hint {
  font-size: 0.85rem;
  color: var(--text-dim);
}

/* ==========================================================================
   Plans Grid & Cards
   ========================================================================== */
.plans-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 26px;
  align-items: stretch;
  max-width: 1120px;
  margin: 0 auto;
  text-align: left;
}

.plan-card {
  --tier-rgb: 245, 158, 11;
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 36px 30px 30px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(var(--tier-rgb), 0.24);
  background:
    radial-gradient(130% 80% at 50% 0%, rgba(var(--tier-rgb), 0.11) 0%, transparent 58%),
    linear-gradient(180deg, rgba(30, 25, 42, 0.92) 0%, rgba(18, 15, 26, 0.97) 100%);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s ease, box-shadow 0.3s ease;
  animation: plan-rise 0.65s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.plan-card:nth-child(2) { animation-delay: 0.08s; }
.plan-card:nth-child(3) { animation-delay: 0.16s; }

.plan-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent 5%, rgba(var(--tier-rgb), 0.95) 50%, transparent 95%);
  opacity: 0.85;
}

.plan-card:hover {
  transform: translateY(-8px);
  border-color: rgba(var(--tier-rgb), 0.55);
  box-shadow: 0 26px 60px -14px rgba(var(--tier-rgb), 0.38), var(--shadow-card);
}

.plan--apprentice    { --tier-rgb: 16, 185, 129; }
.plan--adventurer    { --tier-rgb: 245, 158, 11; }
.plan--dungeon-master { --tier-rgb: 168, 85, 247; }

/* Featured (most popular) card */
.plan-card.featured {
  border-color: rgba(var(--tier-rgb), 0.55);
  box-shadow: 0 0 48px rgba(var(--tier-rgb), 0.22), var(--shadow-card);
  transform: translateY(-12px);
}

.plan-card.featured:hover {
  transform: translateY(-19px);
  box-shadow: 0 34px 70px -16px rgba(var(--tier-rgb), 0.45), 0 0 48px rgba(var(--tier-rgb), 0.25), var(--shadow-card);
}

.plan-card.featured::after {
  content: '';
  position: absolute;
  top: -70px;
  left: 50%;
  transform: translateX(-50%);
  width: 260px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(var(--tier-rgb), 0.2), transparent);
  pointer-events: none;
}

.plan-ribbon {
  position: absolute;
  top: 17px;
  right: -46px;
  transform: rotate(38deg);
  padding: 5px 52px;
  background: linear-gradient(135deg, var(--accent-amber) 0%, var(--accent-gold) 50%, var(--accent-gold-light) 100%);
  color: #1a1207;
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.5);
  z-index: 2;
}

/* Card head */
.plan-head {
  position: relative;
  z-index: 1;
}

.plan-icon {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  margin-bottom: 18px;
  border-radius: 18px;
  font-size: 1.75rem;
  background: radial-gradient(circle at 35% 30%, rgba(var(--tier-rgb), 0.35), rgba(var(--tier-rgb), 0.07) 72%);
  border: 1px solid rgba(var(--tier-rgb), 0.42);
  box-shadow: 0 0 26px rgba(var(--tier-rgb), 0.22), inset 0 1px 1px rgba(255, 255, 255, 0.12);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
}

.plan-card:hover .plan-icon {
  transform: scale(1.06) rotate(-3deg);
  box-shadow: 0 0 36px rgba(var(--tier-rgb), 0.35), inset 0 1px 1px rgba(255, 255, 255, 0.16);
}

.plan-name {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--text-main);
}

.plan-tagline {
  margin-top: 8px;
  min-height: 2.7em;
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.55;
}

/* Price block */
.plan-price-block {
  position: relative;
  margin: 22px 0;
  padding: 20px 0 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.plan-price {
  display: flex;
  align-items: baseline;
  gap: 2px;
  font-family: var(--font-display);
}

.plan-price-currency {
  font-size: 1.35rem;
  font-weight: 700;
  color: rgb(var(--tier-rgb));
  text-shadow: 0 0 18px rgba(var(--tier-rgb), 0.45);
}

.plan-price-amount {
  font-size: 3.1rem;
  font-weight: 800;
  line-height: 1;
  color: #ffffff;
  text-shadow: 0 0 32px rgba(var(--tier-rgb), 0.4);
}

.plan-price-amount.swap {
  animation: price-swap 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.plan-price-period {
  margin-left: 7px;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
}

.plan-billing-note {
  margin-top: 10px;
  min-height: 1.3em;
  font-size: 0.82rem;
  color: var(--text-dim);
}

.plan-save-badge {
  position: absolute;
  top: 16px;
  right: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.42);
  color: #34d399;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.plan-save-badge[hidden] {
  display: none;
}

/* Feature list */
.plan-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0 0 28px;
  flex: 1;
}

.plan-features li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.92rem;
  color: var(--text-main);
  line-height: 1.5;
}

.plan-features li b {
  color: rgb(var(--tier-rgb));
  font-weight: 700;
}

.f-ico {
  flex: 0 0 auto;
  width: 22px;
  text-align: center;
  font-size: 0.95rem;
  line-height: 1.5;
}

.feature-inherit {
  font-family: var(--font-display) !important;
  font-size: 0.78rem !important;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(var(--tier-rgb), 0.95) !important;
  padding-bottom: 2px;
}

/* CTA */
.plan-cta {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 15px 22px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(var(--tier-rgb), 0.48);
  background: rgba(var(--tier-rgb), 0.12);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.plan-cta:hover {
  background: rgba(var(--tier-rgb), 0.22);
  border-color: rgba(var(--tier-rgb), 0.75);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(var(--tier-rgb), 0.32);
}

.plan-cta:active {
  transform: translateY(0) scale(0.99);
}

.plan-card.featured .plan-cta {
  background: linear-gradient(135deg, var(--accent-amber) 0%, var(--accent-gold) 50%, var(--accent-gold-light) 100%);
  border-color: transparent;
  color: #110e08;
  font-weight: 800;
  box-shadow: 0 6px 26px rgba(217, 119, 6, 0.45), inset 0 1px 1px rgba(255, 255, 255, 0.6);
}

.plan-card.featured .plan-cta:hover {
  color: #000000;
  box-shadow: 0 12px 36px rgba(245, 158, 11, 0.6), inset 0 1px 2px rgba(255, 255, 255, 0.8);
}

.plan-cta-note {
  margin-top: 12px;
  text-align: center;
  font-size: 0.76rem;
  color: var(--text-dim);
}

/* ==========================================================================
   Trust Strip
   ========================================================================== */
.plans-trust {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  max-width: 1120px;
  margin: 60px auto 0;
  text-align: left;
}

.trust-item {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 17px 19px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: border-color 0.25s ease, transform 0.25s ease;
}

.trust-item:hover {
  border-color: var(--border-highlight);
  transform: translateY(-3px);
}

.trust-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-size: 1.15rem;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid var(--border-subtle);
}

.trust-copy b {
  display: block;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
}

.trust-copy span {
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* ==========================================================================
   Toast
   ========================================================================== */
.plans-toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  z-index: 999;
  padding: 13px 24px;
  border-radius: var(--radius-full);
  background: rgba(18, 15, 26, 0.96);
  border: 1px solid var(--border-highlight);
  color: var(--text-gold);
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.65), 0 0 24px rgba(245, 158, 11, 0.28);
  opacity: 0;
  transform: translate(-50%, 18px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.plans-toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ==========================================================================
   Animations
   ========================================================================== */
@keyframes plan-rise {
  from {
    opacity: 0;
    translate: 0 26px;
  }
  to {
    opacity: 1;
    translate: 0 0;
  }
}

@keyframes price-swap {
  0% {
    opacity: 0.2;
    translate: 0 8px;
  }
  100% {
    opacity: 1;
    translate: 0 0;
  }
}

/* ==========================================================================
   Membership Status Banner (populated by JS after checkout / status fetch)
   ========================================================================== */
.membership-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 22px;
  max-width: 1120px;
  margin: 38px auto 0;
  padding: 18px 24px;
  text-align: left;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-highlight);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.16), rgba(18, 15, 26, 0.92));
  box-shadow: var(--shadow-card), 0 0 34px rgba(245, 158, 11, 0.18);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.membership-banner[hidden] {
  display: none;
}

.membership-banner-copy strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.02rem;
  color: var(--text-gold);
  letter-spacing: 0.02em;
}

.membership-banner-copy span {
  display: block;
  margin-top: 5px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.membership-banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.membership-btn {
  display: inline-flex;
  align-items: center;
  padding: 9px 18px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-highlight);
  background: rgba(245, 158, 11, 0.12);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), background 0.22s ease, box-shadow 0.22s ease;
}

.membership-btn:hover {
  transform: translateY(-2px);
  background: rgba(245, 158, 11, 0.22);
  box-shadow: 0 10px 26px rgba(245, 158, 11, 0.28);
}

.membership-btn:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1080px) {
  .plans-grid {
    grid-template-columns: 1fr;
    max-width: 460px;
  }

  .plan-card.featured {
    transform: none;
  }

  .plan-card.featured:hover {
    transform: translateY(-8px);
  }

  .plans-trust {
    grid-template-columns: repeat(2, 1fr);
    max-width: 720px;
  }
}

@media (max-width: 600px) {
  .plans-hero {
    padding: 56px 0 72px;
  }

  .billing-option {
    padding: 11px 18px;
    font-size: 0.9rem;
  }

  .plan-card {
    padding: 30px 22px 26px;
  }

  .plan-price-amount {
    font-size: 2.7rem;
  }

  .plans-trust {
    grid-template-columns: 1fr;
  }
}
