/* ── Skyy Plans page (/plans) ── */
@property --plans-accent-h {
  syntax: "<number>";
  inherits: false;
  initial-value: 320;
}

@keyframes plansHueCycle {
  from { --plans-accent-h: 0; }
  to { --plans-accent-h: 360; }
}

.plans-page {
  --plans-accent-h: 320;
  position: fixed;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  background: #000;
  color: #f5f5f7;
  opacity: 0;
  visibility: hidden;
  animation: plansHueCycle 8s linear infinite;
  transition:
    opacity 0.5s cubic-bezier(0.25, 0.1, 0.25, 1),
    visibility 0.5s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.plans-page.is-visible {
  opacity: 1;
  visibility: visible;
}

.plans-page[hidden] {
  display: none !important;
}

.plans-page__ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.plans-page__glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.35;
}

.plans-page__glow--1 {
  bottom: -20%;
  left: -15%;
  width: min(70vw, 560px);
  height: min(70vw, 560px);
  background: radial-gradient(circle, hsla(var(--plans-accent-h), 85%, 55%, 0.5) 0%, transparent 68%);
}

.plans-page__glow--2 {
  top: -25%;
  right: -18%;
  width: min(65vw, 520px);
  height: min(65vw, 520px);
  background: radial-gradient(circle, hsla(calc(var(--plans-accent-h) + 40), 80%, 58%, 0.35) 0%, transparent 70%);
}

.plans-page__inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding:
    calc(20px + env(safe-area-inset-top, 0px))
    calc(20px + env(safe-area-inset-right, 0px))
    calc(40px + env(safe-area-inset-bottom, 0px))
    calc(20px + env(safe-area-inset-left, 0px));
}

.plans-page__topbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  margin-bottom: clamp(28px, 5vh, 48px);
}

.plans-page__logo {
  display: inline-flex;
  text-decoration: none;
  filter: drop-shadow(0 0 24px hsla(var(--plans-accent-h), 85%, 58%, 0.2));
  transition: filter 0.3s ease, transform 0.25s ease;
}

.plans-page__logo:hover,
.plans-page__logo:focus-visible {
  transform: translateY(-1px);
  filter: drop-shadow(0 0 32px hsla(var(--plans-accent-h), 85%, 58%, 0.32));
  outline: none;
}

.plans-page__logo-img {
  display: block;
  height: clamp(36px, 5vh, 48px);
  width: auto;
}

.plans-page__back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: rgba(245, 245, 247, 0.85);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition:
    border-color 0.25s ease,
    background 0.25s ease,
    box-shadow 0.25s ease;
}

.plans-page__back:hover,
.plans-page__back:focus-visible {
  border-color: hsla(var(--plans-accent-h), 85%, 65%, 0.4);
  background: hsla(var(--plans-accent-h), 85%, 65%, 0.08);
  outline: none;
}

.plans-page__hero {
  text-align: center;
  max-width: 560px;
  margin: 0 auto clamp(32px, 5vh, 48px);
}

.plans-page__hero-reveal {
  opacity: 0;
  transform: translateY(14px);
}

.plans-page.is-visible .plans-page__hero-reveal {
  animation: plansReveal 0.7s cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
}

.plans-page.is-visible .plans-page__hero-reveal:nth-child(2) {
  animation-delay: 0.08s;
}

.plans-page.is-visible .plans-page__hero-reveal:nth-child(3) {
  animation-delay: 0.14s;
}

@keyframes plansReveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.plans-page__title {
  margin: 0 0 12px;
  font-size: clamp(1.85rem, 5vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: hsl(var(--plans-accent-h), 88%, 84%);
  text-shadow: 0 0 40px hsla(var(--plans-accent-h), 90%, 58%, 0.2);
}

.plans-page__subtitle {
  margin: 0;
  font-size: clamp(0.92rem, 2.2vw, 1.05rem);
  line-height: 1.55;
  color: rgba(245, 245, 247, 0.55);
}

.plans-page__usd-note {
  margin: 10px 0 0;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(245, 245, 247, 0.35);
}

.plans-page__checkout-message {
  margin: 14px auto 0;
  max-width: 28rem;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.4;
}

.plans-page__checkout-message.is-success {
  color: #9edcff;
  background: rgba(29, 155, 240, 0.12);
  border: 1px solid rgba(29, 155, 240, 0.28);
  box-shadow: 0 0 18px rgba(29, 155, 240, 0.12);
}

.plans-page__checkout-message.is-cancelled {
  color: rgba(245, 245, 247, 0.72);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.plans-page__cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(14px, 2.5vw, 22px);
  align-items: stretch;
}

.plans-card {
  display: flex;
  flex-direction: column;
  padding: clamp(22px, 3vw, 28px);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translateY(18px);
}

.plans-page.is-visible .plans-card {
  animation: plansReveal 0.75s cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
}

.plans-page.is-visible .plans-card--free {
  animation-delay: 0.12s;
}

.plans-page.is-visible .plans-card--pro {
  animation-delay: 0.2s;
}

.plans-card--pro {
  border-color: hsla(var(--plans-accent-h), 75%, 58%, 0.38);
  background:
    linear-gradient(160deg, hsla(var(--plans-accent-h), 85%, 52%, 0.12), rgba(255, 255, 255, 0.03));
  box-shadow:
    0 0 32px hsla(var(--plans-accent-h), 85%, 55%, 0.14),
    0 20px 48px rgba(0, 0, 0, 0.45);
}

.plans-card__badge {
  align-self: flex-start;
  margin-bottom: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid hsla(var(--plans-accent-h), 80%, 62%, 0.35);
  background: hsla(var(--plans-accent-h), 85%, 52%, 0.12);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: hsl(var(--plans-accent-h), 88%, 82%);
}

.plans-card__name {
  margin: 0 0 8px;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.plans-card__price-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  margin-bottom: 6px;
}

.plans-card__price {
  font-size: clamp(1.85rem, 4vw, 2.35rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
}

.plans-card__price-period {
  font-size: 0.88rem;
  font-weight: 500;
  color: rgba(245, 245, 247, 0.55);
}

.plans-card__price-sub {
  margin: 0 0 16px;
  font-size: 0.82rem;
  color: rgba(245, 245, 247, 0.48);
  min-height: 1.2em;
  transition: opacity 0.25s ease;
}

.plans-card__price-sub.is-changing {
  opacity: 0.4;
}

.plans-card__billing {
  display: inline-flex;
  padding: 3px;
  margin-bottom: 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.35);
}

.plans-card__billing-btn {
  position: relative;
  padding: 8px 14px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: rgba(245, 245, 247, 0.55);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    color 0.25s ease,
    background 0.25s ease;
}

.plans-card__billing-btn.is-active {
  background: hsla(var(--plans-accent-h), 85%, 52%, 0.22);
  color: hsl(var(--plans-accent-h), 88%, 88%);
}

.plans-card__billing-btn:hover:not(.is-active),
.plans-card__billing-btn:focus-visible:not(.is-active) {
  color: rgba(245, 245, 247, 0.85);
  outline: none;
}

.plans-card__savings {
  position: absolute;
  top: -10px;
  right: -6px;
  padding: 3px 8px;
  border-radius: 999px;
  background: hsl(var(--plans-accent-h), 88%, 58%);
  color: #000;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.plans-card__features {
  flex: 1;
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.plans-card__feature {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.84rem;
  line-height: 1.45;
  color: rgba(245, 245, 247, 0.78);
}

.plans-card__feature::before {
  content: "";
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  margin-top: 0.45em;
  border-radius: 50%;
  background: hsl(var(--plans-accent-h), 90%, 62%);
  box-shadow: 0 0 8px hsla(var(--plans-accent-h), 90%, 62%, 0.55);
}

.plans-card--free .plans-card__feature::before {
  background: rgba(255, 255, 255, 0.35);
  box-shadow: none;
}

.plans-card__cta {
  width: 100%;
  min-height: 46px;
  padding: 0 20px;
  border: none;
  border-radius: 14px;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease,
    opacity 0.25s ease;
}

.plans-card__cta:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.plans-card__cta--ghost {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(245, 245, 247, 0.72);
}

.plans-card__cta--ghost.is-current {
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(245, 245, 247, 0.55);
}

.plans-card__cta--pro {
  border: 1px solid hsla(var(--plans-accent-h), 80%, 58%, 0.45);
  background: linear-gradient(
    135deg,
    hsl(var(--plans-accent-h), 88%, 58%) 0%,
    hsl(calc(var(--plans-accent-h) + 35), 88%, 52%) 100%
  );
  color: #000;
  box-shadow: 0 0 24px hsla(var(--plans-accent-h), 90%, 55%, 0.28);
}

.plans-card__cta--pro:not(:disabled):hover,
.plans-card__cta--pro:not(:disabled):focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 0 32px hsla(var(--plans-accent-h), 90%, 55%, 0.38);
  outline: none;
}

body[data-view="plans"] .connections-trigger,
body[data-view="plans"] .skyyjack-trigger {
  display: none;
}

@media (max-width: 720px) {
  .plans-page__cards {
    grid-template-columns: 1fr;
  }

  .plans-card--pro {
    order: -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .plans-page {
    animation: none;
    transition: none;
  }

  .plans-page__hero-reveal,
  .plans-card {
    opacity: 1;
    transform: none;
    animation: none !important;
  }

  .plans-card__cta--pro:not(:disabled):hover,
  .plans-card__cta--pro:not(:disabled):focus-visible {
    transform: none;
  }
}

/* ── Checkout cancelled fail-safe (/plans?checkout=cancelled) ── */
.plans-checkout-cancelled {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #06060a;
  color: #f5f5f7;
}

html.is-plans-checkout-cancelled .plans-checkout-cancelled {
  display: flex;
}

html.is-plans-checkout-cancelled .session-loading,
html.is-plans-checkout-cancelled #session-loading {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.plans-checkout-cancelled__panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: min(100%, 360px);
  text-align: center;
}

.plans-checkout-cancelled__logo {
  display: block;
  width: auto;
  height: 40px;
}

.plans-checkout-cancelled__title {
  margin: 0;
  font-size: clamp(1.35rem, 4vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.plans-checkout-cancelled__back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 28px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #f5f5f7;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.plans-checkout-cancelled__back:hover,
.plans-checkout-cancelled__back:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.28);
  outline: none;
}
