/* ═══════════════════════════════════════════════════════════════════════════
 * PHANTOM FX v2 — JustBuyNow Premium Layer
 * Liquid Glass · Scroll Effects · Magnetic Hover · Spectral Glow
 * Loaded after mobile-fix.css. Pure CSS, JS-enhanced via phantom-fx-v2.js.
 * ═══════════════════════════════════════════════════════════════════════════ */

:root {
    /* Locked CTA color per JBN brand rule */
    --jbn-cta: #0066cc;
    --jbn-cta-hover: #0052a3;
    --jbn-cta-glow: rgba(0, 102, 204, 0.45);

    /* Phantom accent palette */
    --fx-indigo: #6366f1;
    --fx-violet: #8b5cf6;
    --fx-cyan: #22d3ee;
    --fx-amber: #fbbf24;
    --fx-rose: #fb7185;

    /* Glass surface system */
    --glass-bg: rgba(15, 23, 42, 0.55);
    --glass-bg-strong: rgba(15, 23, 42, 0.78);
    --glass-border: rgba(148, 163, 184, 0.18);
    --glass-border-hover: rgba(99, 102, 241, 0.42);
    --glass-shadow: 0 8px 32px rgba(15, 23, 42, 0.4);
    --glass-shadow-hover: 0 16px 48px rgba(99, 102, 241, 0.28);

    /* Timing — fluid premium curves (Liquid Glass spec: 400-600ms) */
    --fx-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --fx-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --fx-out: cubic-bezier(0, 0, 0.2, 1);
}

/* ─── 1 · SCROLL PROGRESS BAR ────────────────────────────────────────────── */
.fx-scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0%;
    background: linear-gradient(90deg, var(--jbn-cta), var(--fx-indigo), var(--fx-violet));
    z-index: 9999;
    transition: width 80ms linear;
    box-shadow: 0 0 12px var(--jbn-cta-glow);
    pointer-events: none;
}

/* ─── 2 · REVEAL ANIMATIONS (IntersectionObserver-driven) ─────────────────── */
.fx-reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 600ms var(--fx-smooth), transform 600ms var(--fx-spring);
    will-change: opacity, transform;
}
.fx-reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}
.fx-reveal-stagger > *:nth-child(1) { transition-delay: 0ms; }
.fx-reveal-stagger > *:nth-child(2) { transition-delay: 70ms; }
.fx-reveal-stagger > *:nth-child(3) { transition-delay: 140ms; }
.fx-reveal-stagger > *:nth-child(4) { transition-delay: 210ms; }
.fx-reveal-stagger > *:nth-child(5) { transition-delay: 280ms; }
.fx-reveal-stagger > *:nth-child(6) { transition-delay: 350ms; }

/* ─── 3 · LIQUID GLASS CARDS ─────────────────────────────────────────────── */
.summary-card,
.article-hero__panel-card,
.related-post-card,
.sidebar-widget {
    backdrop-filter: blur(12px) saturate(140%);
    -webkit-backdrop-filter: blur(12px) saturate(140%);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)) !important;
    border: 1px solid var(--glass-border) !important;
    box-shadow: var(--glass-shadow) !important;
    transition: transform 480ms var(--fx-spring),
                box-shadow 480ms var(--fx-smooth),
                border-color 480ms var(--fx-smooth),
                background 480ms var(--fx-smooth);
    will-change: transform;
}

.summary-card:hover,
.article-hero__panel-card:hover,
.related-post-card:hover {
    transform: translateY(-6px) scale(1.005);
    border-color: var(--glass-border-hover) !important;
    box-shadow: var(--glass-shadow-hover) !important;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.10), rgba(34, 211, 238, 0.04)) !important;
}

/* ─── 4 · CTA BUTTONS — LOCKED at #0066cc, with spectral glow ────────────── */
.sidebar-buy-btn,
.article-prose a.btn-primary,
.article-prose a[class*="cta-button"],
.wp-block-button.is-style-jbn-cta .wp-block-button__link,
.jbn-cta-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 26px;
    background: var(--jbn-cta) !important;
    color: #fff !important;
    border: 0;
    border-radius: 10px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-decoration: none !important;
    box-shadow: 0 6px 20px var(--jbn-cta-glow);
    transition: transform 280ms var(--fx-spring),
                box-shadow 280ms var(--fx-smooth),
                background 280ms var(--fx-smooth);
    overflow: hidden;
    cursor: pointer;
    isolation: isolate;
}
.sidebar-buy-btn::before,
.jbn-cta-btn::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
        rgba(255, 255, 255, 0.32) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 320ms var(--fx-smooth);
    z-index: -1;
}
.sidebar-buy-btn:hover,
.jbn-cta-btn:hover {
    transform: translateY(-3px) scale(1.02);
    background: var(--jbn-cta-hover) !important;
    box-shadow: 0 12px 32px var(--jbn-cta-glow);
}
.sidebar-buy-btn:hover::before,
.jbn-cta-btn:hover::before {
    opacity: 1;
}
.sidebar-buy-btn:active,
.jbn-cta-btn:active {
    transform: translateY(-1px) scale(0.99);
    transition-duration: 100ms;
}

/* Pulsing halo for the primary hero CTA */
.article-hero__panel-card .sidebar-buy-btn {
    animation: jbn-cta-halo 3s ease-in-out infinite;
}
@keyframes jbn-cta-halo {
    0%, 100% { box-shadow: 0 6px 20px var(--jbn-cta-glow); }
    50%      { box-shadow: 0 6px 32px rgba(0, 102, 204, 0.7), 0 0 0 4px rgba(0, 102, 204, 0.12); }
}

/* ─── 5 · ANIMATED UNDERLINE on internal links ───────────────────────────── */
.article-prose a:not([href*="amazon"]):not([class*="btn"]):not(.no-underline) {
    position: relative;
    text-decoration: none;
    color: var(--fx-indigo);
    background-image: linear-gradient(90deg, var(--fx-indigo), var(--fx-violet));
    background-size: 0% 2px;
    background-repeat: no-repeat;
    background-position: 0 100%;
    transition: background-size 320ms var(--fx-out), color 200ms;
    padding-bottom: 2px;
}
.article-prose a:not([href*="amazon"]):not([class*="btn"]):not(.no-underline):hover {
    background-size: 100% 2px;
    color: #a5b4fc;
}

/* ─── 6 · SPECTRAL GLOW on featured image ────────────────────────────────── */
.article-featured-img {
    position: relative;
    overflow: hidden;
    transition: transform 600ms var(--fx-spring), box-shadow 600ms var(--fx-smooth);
}
.article-featured-img::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(115deg,
        transparent 30%,
        rgba(99, 102, 241, 0.16) 50%,
        transparent 70%);
    transform: translateX(-100%);
    transition: transform 1200ms var(--fx-smooth);
    pointer-events: none;
}
.article-featured-img:hover {
    transform: scale(1.01);
    box-shadow: 0 24px 64px rgba(99, 102, 241, 0.22);
}
.article-featured-img:hover::after {
    transform: translateX(100%);
}

/* ─── 7 · BACK-TO-TOP FLOATING BUTTON ────────────────────────────────────── */
.fx-back-to-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: var(--glass-bg-strong);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    color: #fff;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
    transition: opacity 320ms var(--fx-smooth),
                transform 320ms var(--fx-spring),
                background 200ms,
                border-color 200ms;
    z-index: 998;
    cursor: pointer;
}
.fx-back-to-top.is-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.fx-back-to-top:hover {
    background: rgba(99, 102, 241, 0.25);
    border-color: var(--glass-border-hover);
    transform: translateY(-3px) scale(1.06);
}

/* ─── 8 · STICKY MOBILE AFFILIATE CTA BAR ───────────────────────────────── */
.fx-mobile-cta {
    position: fixed;
    bottom: -100px;
    left: 0;
    right: 0;
    padding: 12px 16px;
    background: var(--glass-bg-strong);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    border-top: 1px solid var(--glass-border);
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.4);
    z-index: 997;
    transition: bottom 420ms var(--fx-spring);
    display: none;
}
@media (max-width: 768px) {
    .fx-mobile-cta { display: block; }
    .fx-mobile-cta.is-visible { bottom: 0; }
    .fx-mobile-cta .fx-mobile-cta__btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        width: 100%;
        padding: 14px 16px;
        background: var(--jbn-cta);
        color: #fff;
        font-weight: 600;
        text-decoration: none;
        border-radius: 10px;
        font-size: 15px;
        box-shadow: 0 4px 16px var(--jbn-cta-glow);
    }
}

/* ─── 9 · SKELETON / SHIMMER ─────────────────────────────────────────────── */
.fx-skeleton {
    background: linear-gradient(90deg,
        rgba(148, 163, 184, 0.06) 0%,
        rgba(148, 163, 184, 0.12) 50%,
        rgba(148, 163, 184, 0.06) 100%);
    background-size: 200% 100%;
    animation: fx-shimmer 1.6s ease-in-out infinite;
    border-radius: 8px;
}
@keyframes fx-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ─── 10 · LIQUID MORPHING BACKGROUND BLOBS behind hero ──────────────────── */
.article-hero {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}
.article-hero::before {
    content: "";
    position: absolute;
    top: -20%;
    left: -10%;
    width: 60%;
    height: 140%;
    background: radial-gradient(ellipse at center,
        rgba(99, 102, 241, 0.18) 0%,
        transparent 60%);
    border-radius: 50%;
    filter: blur(40px);
    animation: fx-blob-drift-a 22s ease-in-out infinite alternate;
    z-index: -1;
    pointer-events: none;
}
.article-hero::after {
    content: "";
    position: absolute;
    top: 10%;
    right: -10%;
    width: 50%;
    height: 120%;
    background: radial-gradient(ellipse at center,
        rgba(34, 211, 238, 0.12) 0%,
        transparent 60%);
    border-radius: 50%;
    filter: blur(50px);
    animation: fx-blob-drift-b 28s ease-in-out infinite alternate;
    z-index: -1;
    pointer-events: none;
}
@keyframes fx-blob-drift-a {
    0%   { transform: translate(0, 0) scale(1) rotate(0deg); }
    50%  { transform: translate(8%, 4%) scale(1.1) rotate(20deg); }
    100% { transform: translate(-4%, 8%) scale(0.95) rotate(-10deg); }
}
@keyframes fx-blob-drift-b {
    0%   { transform: translate(0, 0) scale(1); }
    50%  { transform: translate(-6%, 6%) scale(1.08); }
    100% { transform: translate(4%, -4%) scale(0.98); }
}

/* ─── 11 · CATEGORY BADGE sparkle ────────────────────────────────────────── */
.article-cat-badge {
    position: relative;
    overflow: hidden;
}
.article-cat-badge::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: fx-sparkle 4s ease-in-out infinite;
}
@keyframes fx-sparkle {
    0%, 80%, 100% { left: -100%; }
    90%           { left: 100%; }
}

/* ─── 12 · NAV LINK SHIMMER ──────────────────────────────────────────────── */
.main-navigation a {
    position: relative;
    overflow: hidden;
}
.main-navigation a::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: left 600ms var(--fx-smooth);
    pointer-events: none;
}
.main-navigation a:hover::before {
    left: 100%;
}

/* ─── 13 · NUMBER EMPHASIS ───────────────────────────────────────────────── */
[data-fx-count],
.fx-stat-number {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    background: linear-gradient(135deg, var(--fx-indigo), var(--fx-cyan));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    display: inline-block;
}

/* ─── 14 · BREADCRUMB POLISH ─────────────────────────────────────────────── */
.breadcrumb {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: var(--glass-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    font-size: 13px;
    color: rgba(226, 232, 240, 0.8);
}
.breadcrumb a {
    color: var(--fx-cyan);
    text-decoration: none;
    transition: color 200ms;
}
.breadcrumb a:hover { color: #fff; }

/* ─── 15 · FAQ ACCORDION (details/summary) ───────────────────────────────── */
.article-prose details {
    background: var(--glass-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 16px 20px;
    margin: 12px 0;
    transition: border-color 320ms, background 320ms;
}
.article-prose details[open] {
    border-color: var(--glass-border-hover);
    background: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(34,211,238,0.03));
}
.article-prose details summary {
    cursor: pointer;
    font-weight: 600;
    color: #fff;
    list-style: none;
    position: relative;
    padding-right: 28px;
    transition: color 200ms;
}
.article-prose details summary::-webkit-details-marker { display: none; }
.article-prose details summary::after {
    content: "+";
    position: absolute;
    right: 0;
    top: 0;
    font-size: 22px;
    line-height: 1;
    font-weight: 300;
    color: var(--fx-cyan);
    transition: transform 320ms var(--fx-spring);
}
.article-prose details[open] summary::after {
    transform: rotate(45deg);
}
.article-prose details[open] summary { color: var(--fx-cyan); }

/* ─── 16 · FIGURE LIFT ───────────────────────────────────────────────────── */
.article-prose figure {
    overflow: hidden;
    border-radius: 16px;
    transition: transform 480ms var(--fx-spring),
                box-shadow 480ms var(--fx-smooth);
}
.article-prose figure img {
    transition: transform 600ms var(--fx-smooth);
}
.article-prose figure:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 48px rgba(99, 102, 241, 0.2);
}
.article-prose figure:hover img {
    transform: scale(1.03);
}

/* ─── 17 · REDUCED MOTION ────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .article-hero::before,
    .article-hero::after,
    .article-cat-badge::after,
    .main-navigation a::before,
    .article-hero__panel-card .sidebar-buy-btn,
    .fx-skeleton {
        animation: none !important;
    }
    .fx-reveal {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
}
