/**
 * Membership CTA Styles
 *
 * Executes design-spec.md (docs/membership-cta-design-spec.md).
 * Extends .wm-upsell-* namespace from account-plan.css — does NOT duplicate.
 * Consumes design tokens from brand-tokens.css via var().
 *
 * Sections:
 *   A. Tier grid layout (multi-plan comparison)
 *   B. New design-spec elements (eyebrow, price-line, badge, badge-reason)
 *   C. Variant modifiers (--highlight, --compact, --tight)
 *   D. Mobile behavior (<640px)
 *   E. Accessibility (focus, reduced-motion)
 *
 * Anti-pattern guards (per design-spec section 10):
 *   - No .tier-* slug classes
 *   - No emoji in content:
 *   - No pink/rose drift
 *   - No SaaS-style gradients
 *   - No urgency animations
 *   - No dark-mode rules (brand-tokens.css owns dark globally)
 *
 * @see docs/membership-cta-design-spec.md
 */

/* ── A. Tier Grid Layout ── */

.wm-tier-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--wm-space-6, 24px);
    align-items: stretch;
}

/* Enable bottom-aligned CTA across cards with varying benefit lengths. */
.wm-tier-grid .wm-upsell {
    display: flex;
    flex-direction: column;
}

.wm-tier-grid .wm-upsell__cta {
    margin-top: auto;
}

/* ── B. New Design-Spec Elements ── */

/* Eyebrow — small uppercase context label (design-spec section 3, element 1). */
.wm-upsell__eyebrow {
    display: block;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--wm-text-muted, #7A7470);
    margin-bottom: var(--wm-space-2, 8px);
}

/* Price line — inline context string, NOT a hero number (design-spec section 4). */
.wm-upsell__price-line {
    font-size: 15px;
    color: var(--muted-foreground, var(--wm-text-muted, #7A7470));
    margin-top: var(--wm-space-2, 8px);
    margin-bottom: var(--wm-space-3, 12px);
    line-height: 1.5;
}

/* Recommended badge + reason sub-text (design-spec section 5). */
.wm-upsell__badge {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    background: var(--wm-accent, #C1AE8E);
    color: #fff;
    border-radius: var(--wm-radius-xs, 4px);
    padding: var(--wm-space-1, 4px) var(--wm-space-2, 8px);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: var(--wm-space-3, 12px);
    max-width: 100%;
}

.wm-upsell__badge-label {
    display: block;
}

.wm-upsell__badge-reason {
    display: block;
    font-size: 11px;
    font-weight: 400;
    font-style: italic;
    opacity: 0.88;
    margin-top: 2px;
}

/* ── C. Variant Modifiers ── */

/* --highlight: recommended tier receives accent border + elevated shadow.
   Card height does NOT change — maintains comparison scannability. */
.wm-upsell--highlight {
    border: 2px solid var(--wm-accent, #C1AE8E) !important;
    box-shadow: var(--wm-shadow-lg, 0 4px 16px rgba(0,0,0,0.08)) !important;
}

/* Mobile: recommended tier stacks first. */
.wm-upsell--highlight {
    order: -1;
}

/* --compact: for Layer 2/4 inline contexts.
   Smaller padding, trust row + learn-more hidden. */
.wm-upsell--compact {
    padding: var(--wm-space-5, 20px) !important;
}

.wm-upsell--compact .wm-upsell__trust,
.wm-upsell--compact .wm-upsell__learn-more {
    display: none !important;
}

/* --tight: single-row inline layout (Layer 4 soft CTA).
   Only eyebrow + title + price-line + CTA visible. */
.wm-upsell--tight {
    display: flex;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--wm-space-4, 16px);
    padding: var(--wm-space-4, 16px) var(--wm-space-5, 20px) !important;
}

.wm-upsell--tight .wm-upsell__benefits,
.wm-upsell--tight .wm-upsell__trust,
.wm-upsell--tight .wm-upsell__learn-more,
.wm-upsell--tight .wm-upsell__badge,
.wm-upsell--tight .wm-upsell__subtitle {
    display: none !important;
}

.wm-upsell--tight .wm-upsell__eyebrow {
    width: 100%;
    margin-bottom: var(--wm-space-1, 4px);
}

.wm-upsell--tight .wm-upsell__title {
    flex: 1 1 180px;
    font-size: 16px !important;
    margin: 0 !important;
}

.wm-upsell--tight .wm-upsell__price-line {
    flex: 0 0 auto;
    margin: 0 !important;
    font-size: 14px;
}

.wm-upsell--tight .wm-upsell__cta {
    flex: 0 0 auto;
    margin-top: 0 !important;
    white-space: nowrap;
    /* Tight CTA is rendered as a text-link style */
    background: transparent !important;
    color: var(--wm-primary, #4685A5) !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    text-decoration: underline;
    font-weight: 600;
}

.wm-upsell--tight .wm-upsell__cta:hover {
    opacity: 0.8;
}

/* ── D. Mobile (<640px) ── */

@media (max-width: 640px) {
    .wm-tier-grid {
        grid-template-columns: 1fr;
    }

    /* All cards revert to natural order on mobile — except --highlight which stays first. */
    .wm-tier-grid .wm-upsell {
        order: 0;
    }

    .wm-tier-grid .wm-upsell--highlight {
        order: -1;
    }

    /* Compact variant gains sticky bottom CTA on mobile. */
    .wm-upsell--compact .wm-upsell__cta {
        position: sticky;
        bottom: 0;
        background: var(--background, var(--wm-bg-content, #fff));
        padding: var(--wm-space-2, 8px) 0;
        width: 100%;
    }

    /* --tight collapses to stacked on very small screens. */
    .wm-upsell--tight {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--wm-space-2, 8px);
    }

    .wm-upsell--tight .wm-upsell__cta {
        padding: var(--wm-space-2, 8px) 0 !important;
    }
}

/* Tap targets — all CTA buttons and links minimum 48×48px (beyond WCAG 44×44). */
.wm-upsell__cta,
.wm-upsell__learn-more a {
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ── E. Accessibility ── */

.wm-upsell__cta:focus-visible,
.wm-upsell__learn-more a:focus-visible {
    outline: 2px solid var(--ring, var(--wm-primary, #4685A5));
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .wm-upsell,
    .wm-upsell__cta,
    .wm-upsell__badge {
        transition: none !important;
        animation: none !important;
    }
}
