/* Load in animations for the main page elements, triggered by the 'page-loaded' class added on window load. */
.pricing-header-group {
    opacity: 0;
    filter: blur(20px);
    transform: translateY(-20px);
    transition: all 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.pricing-card {
    opacity: 0;
    /* Tilt back slightly on the X-axis */
    transform: translateY(60px) perspective(1000px) rotateX(-15deg);
    transition: all 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pricing-note {
    opacity: 0;
    transition: opacity 1s ease-in;
}

/* Watermark — start hidden & nudged up, drop in after the header */
.watermark2 {
    opacity: 0;
    transform: translateX(-50%);
    transition: opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.6s;
}

/* Execution State: Triggered by JS */
body.pricing-loaded .pricing-header-group {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
}

body.pricing-loaded .pricing-card.reveal {
    opacity: 1;
    transform: translateY(0) perspective(1000px) rotateX(0deg);
}

body.pricing-loaded .pricing-note.reveal {
    opacity: 1;
}

body.pricing-loaded .watermark2 {
    opacity: 0.9;
    transform: translateX(-50%);
}


/* Override styles.css which locks overflow:hidden on html/body for index */
html,
body {
    overflow-x: hidden;
    overflow-y: auto;
    height: auto;
    min-height: 100%;
}

.pricing-wrapper {
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    /* overflow:hidden removed — it was blocking scroll */
}

/* Fixed so the video never contributes to page height */
.pricing-bg-video {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    object-fit: cover;
    pointer-events: none;
    z-index: 0;
    /* Deterministic entrance: start hidden until JS marks first frame ready */
    opacity: 0;
    filter: saturate(1.5);
    transition: filter 0.5s ease, opacity 0.45s ease, transform 0.45s ease;
    background: transparent;
    backface-visibility: hidden;
    transform: translateZ(0) scale(1.03);
}

/* Replay-safe entrance class (mount lifecycle driven, independent of body route classes). */
.pricing-bg-video.is-ready.video-enter {
    opacity: 0.05;
    transform: translateZ(0) scale(1);
    filter: saturate(1.5);
}

body.is-hovering .pricing-bg-video.is-ready.video-enter {
    filter: saturate(1) blur(8px);
    opacity: 0.02;
}

.pricing-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 860px;
    padding: 5rem 2rem 3rem;
    gap: 2.5rem;
    z-index: 10;
}

.pricing-header-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    text-align: center;
}

.pricing-header h1 {
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: -0.5px;
    color: var(--text-color);
    margin-bottom: 0.4rem;
    /* Added for particle effect */
    display: inline-block;
}

.pricing-header p {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.billing-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    user-select: none;
    background: rgba(0, 0, 0, 0.04);
    padding: 6px 10px;
    border-radius: 999px;
    border: 0.5px solid rgba(0, 0, 0, 0.05);
}

#label-usd,
#label-robux {
    cursor: auto;
    transform: translateY(-1px);
}

body.dark-theme .billing-toggle {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.05);
}

body.dark-theme .toggle-pill {
    background: rgba(255, 255, 255, 0.3);
}

.billing-toggle span {
    width: 55px;
    display: inline-block;
    transition: color 0.2s ease;
}

.billing-toggle span:first-child {
    text-align: right;
}

.billing-toggle span:last-child {
    text-align: left;
}

.toggle-pill {
    width: 36px;
    height: 20px;
    border-radius: 999px;
    background: var(--text-muted);
    opacity: 0.4;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.toggle-pill.on {
    background: var(--text-color);
    opacity: 1;
}

.toggle-pill::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--bg-color);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toggle-pill.on::after {
    transform: translateX(16px);
}

.pricing-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    width: 100%;
    perspective: 1000px;
    /* Perspective container for the 3D effect */
}

/* pricing.css — remove will-change from the static rule */
.pricing-card {
    background: rgba(0, 0, 0, 0.02);
    border: 0.5px solid rgba(0, 0, 0, 0.1);
    border-radius: 16px;
    padding: 1.75rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    position: relative;
    transform-style: preserve-3d;
    /* will-change removed from here */
    transition: box-shadow 0.3s ease, border-color 0.3s ease,
                transform 0.4s cubic-bezier(0.2, 1, 0.3, 1);
}

body.dark-theme .pricing-card {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
}

.pricing-card.featured {
    background: var(--text-color);
    border-color: transparent;
}

body.dark-theme .pricing-card.featured {
    background: #fcfcfc;
}

.pricing-card.featured .card-tier,
.pricing-card.featured .card-desc,
.pricing-card.featured .price-amount,
.pricing-card.featured .price-label,
.pricing-card.featured .feature-item {
    color: var(--bg-color) !important;
}

body.dark-theme .pricing-card.featured .card-tier,
body.dark-theme .pricing-card.featured .card-desc,
body.dark-theme .pricing-card.featured .price-amount,
body.dark-theme .pricing-card.featured .price-label,
body.dark-theme .pricing-card.featured .feature-item {
    color: #1a1a1a !important;
}

.popular-badge {
    position: absolute;
    top: -1px;
    left: 50%;
    transform: translateX(-50%) translateZ(10px);
    /* Popped out slightly for 3D effect */
    font-size: 0.65rem;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: 0 0 8px 8px;
    background: var(--bg-color);
    color: var(--text-color);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

body.dark-theme .popular-badge {
    background: #1a1a1a;
    /* black */
    color: #fcfcfc;
    /* white text */
}

.card-top,
.price-block,
.feature-list,
.cta-btn {
    /* Layering to emphasize the 3D parallax effect */
    transform: translateZ(20px);
}

.card-top {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.card-tier {
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.card-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
    min-height: calc(0.8rem * 1.5 * 2);
    /* reserve 2 lines so hr stays level */
}

.price-block {
    display: flex;
    align-items: baseline;
    gap: 0.3rem;
}

.price-amount {
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: -1px;
    color: var(--text-color);
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.price-label {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.feature-divider {
    height: 0.5px;
    background: rgba(0, 0, 0, 0.08);
    border: none;
    margin: 0;
    transform: translateZ(10px);
}

body.dark-theme .feature-divider {
    background: rgba(255, 255, 255, 0.08);
}

/* Featured card (dark bg in light mode, light bg in dark mode) */
.pricing-card.featured .feature-divider {
    background: rgba(255, 255, 255, 0.2);
}

body.dark-theme .pricing-card.featured .feature-divider {
    background: rgba(0, 0, 0, 0.15);
}

.feature-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    flex: 1;
}

.feature-item {
    font-size: 0.8rem;
    color: var(--text-color);
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.feature-item::before {
    content: '–';
    opacity: 0.35;
}

.cta-btn {
    width: 100%;
    height: 36px;
    border-radius: 10px;
    border: 0.5px solid rgba(0, 0, 0, 0.12);
    background: var(--hover-bg);
    color: var(--text-color);
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    position: relative;
    z-index: 2;
}

.cta-btn:hover {
    opacity: 0.75;
}

.robux-icon {
    height: 0.77em;
    width: auto;
    display: inline-block;
    object-fit: contain;
    filter: brightness(0);
    vertical-align: middle;
    position: relative;
    top: 0.035em;
}

body.dark-theme .robux-icon,
.pricing-card.featured .robux-icon {
    filter: brightness(0) invert(1);
}

body.dark-theme .pricing-card.featured .robux-icon {
    filter: brightness(0);
}

body.dark-theme .pricing-card.featured .cta-btn {
    color: #1a1a1a;
    /* dark text on light button */
    background: #fcfcfc;
    border-color: rgba(0, 0, 0, 0.1);
}

/* ---- Watermark — fixed position, hide on mobile where it clips text ---- */
.watermark2 {
    top: 2rem;
    mix-blend-mode: normal;
}

@media (max-width: 860px) {

    .watermark2 {
        display: none;
    }

    body.pricing-loaded {
        transform: none !important;
    }

}

.pricing-note {
    font-size: 0.72rem;
    color: var(--text-muted);
    opacity: 0.6;
    text-align: center;
}

/* Card cursors */
.pricing-card,
.pricing-card * {
    cursor: default !important;
}

.pricing-card .cta-btn,
.pricing-card .cta-btn * {
    cursor: pointer !important;
}

/* =============================================
           RESPONSIVE — pricing page
           ============================================= */

/* ---- TABLET (≤ 860px): 2-column + 1 centred card ---- */
@media (max-width: 860px) {
    .pricing-wrapper {
        align-items: flex-start;
    }

    .pricing-inner {
        padding: 5rem 1.5rem 3rem;
        gap: 2rem;
    }

    .pricing-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Featured card spans full width and sits on its own row */
    .pricing-card.featured {
        grid-column: 1 / -1;
        order: -1;
        /* pull above Starter & Studio so they can share the row below */
        max-width: 380px;
        justify-self: center;
        width: 100%;
    }
}

/* ---- MOBILE (≤ 600px): single-column stack ---- */
@media (max-width: 600px) {
    .pricing-inner {
        padding: 4.5rem 1rem 2.5rem;
        gap: 1.5rem;
    }

    .pricing-header h1 {
        font-size: 1.55rem;
    }

    .pricing-cards {
        grid-template-columns: 1fr;
        gap: 0.85rem;
    }

    .pricing-card.featured {
        grid-column: auto;
        max-width: 100%;
        justify-self: stretch;
        padding-top: 2rem; /* slight offset for .popular-badge, kept minimal */
    }

    .pricing-card {
        padding: 1.75rem 1.6rem; /* align top padding with desktop to avoid inconsistency */
        will-change: auto;
    }

    .price-amount {
        font-size: 1.75rem;
    }
}

/* ---- SMALL MOBILE (≤ 380px) ---- */
@media (max-width: 380px) {
    .pricing-inner {
        padding: 4rem 0.75rem 2rem;
    }

    .billing-toggle {
        font-size: 0.75rem;
        padding: 5px 8px;
    }

    .pricing-header h1 {
        font-size: 1.35rem;
    }
}

/* ---- LANDSCAPE PHONE ---- */
@media (max-height: 500px) and (orientation: landscape) {
    .pricing-inner {
        padding: 4rem 1.5rem 1.5rem;
        gap: 1.25rem;
    }

    .pricing-cards {
        grid-template-columns: repeat(3, 1fr);
    }

    .pricing-card.featured {
        grid-column: auto;
        max-width: 100%;
        justify-self: stretch;
    }

    .pricing-card {
        padding: 1rem 1rem;
        gap: 0.75rem;
    }

    .price-amount {
        font-size: 1.5rem;
    }

    .feature-list {
        gap: 0.4rem;
    }

    .watermark2 {
        display: none;
    }
}

/* ---- Touch: disable tilt cursor hint ---- */
@media (hover: none) {
    .pricing-card {
        /* Preserve the transform transition so the entrance animation still plays.
           Only strip the tilt cursor hint — tilt is disabled in JS already via
           the isTouchOnly() guard, so no JS change needed here. */
        transition: box-shadow 0.3s ease,
                    border-color 0.3s ease,
                    transform 0.4s cubic-bezier(0.2, 1, 0.3, 1) !important;
    }
}

/* =============================================
   WATERMARK HEIGHT RESPONSIVENESS
   Prevents .watermark2 from clipping into page
   content as viewport height shrinks.
   Only applies on desktop (> 860px wide) where
   the watermark is actually visible.
   ============================================= */

/* 855px — content starts rising toward watermark, nudge it up */
@media (min-width: 861px) and (max-height: 855px) {
    .watermark2 {
        top: 3.5rem;
        transition: opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.6s;
    }
}

/* 810px — pull further up */
@media (min-width: 861px) and (max-height: 810px) {
    .watermark2 {
        top: 2.5rem;
    }
}

/* 700px — almost touching; retreat and fade out */
@media (max-height: 700px) {
    .watermark2 {
        top: 0.8rem;
    }
}

@media (min-width: 861px) {
    .watermark2 {
        top: 2rem;
    }
}

/* 620px — no room left, hide entirely */
@media (min-width: 861px) and (max-height: 780px) {
    .watermark2 {
        display: none !important;
    }
}

/* pricing.css */
@media (prefers-reduced-motion: reduce) {
    .pricing-header-group,
    .pricing-card,
    .pricing-note,
    .watermark2 {
        transition: none !important;
        opacity: 1 !important;
        transform: none !important;
        filter: none !important;
    }
}