/* Jafoorrr local experience layer — no external runtime dependencies. */
/* Legacy page reveals and the shared observer previously animated transforms
   on nested elements simultaneously. Keep the layout stable during reveals. */
body :is(.fade-up, .guide-section, .featured-card) {
    opacity: 1;
    transform: none !important;
    filter: none !important;
    animation: none !important;
    transition-property: opacity, background-color, border-color, box-shadow !important;
}
body .guide-section :is(.section-body, .section-title, .section-number) {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
    animation: none !important;
}
body .guide-section > * { opacity: 1 !important; }
:root {
    --jp-accent: #ff3b30;
    --jp-accent-rgb: 255, 59, 48;
    --jp-surface: rgba(13, 13, 15, 0.86);
    --jp-surface-raised: rgba(20, 17, 18, 0.92);
}

html {
    /* Native scrollbar dragging and Lenis must update the document immediately.
       Explicit scrollTo({ behavior: 'smooth' }) calls remain animated. */
    scroll-behavior: auto !important;
}

body.jp-experience {
    background-attachment: fixed;
}

/* A quiet red horizon gives the existing black background more depth without
   replacing any legacy body pseudo-elements. */
.jp-ambient-horizon {
    position: fixed;
    z-index: 0;
    left: 50%;
    bottom: -34vh;
    width: min(1100px, 110vw);
    height: 58vh;
    translate: -50% 0;
    border-radius: 50%;
    pointer-events: none;
    background: rgba(var(--jp-accent-rgb), 0.12);
    filter: blur(110px);
}

/* Hero refinement. Existing content remains fully visible before this CSS loads. */
.hero-section {
    isolation: isolate;
}

.hero-title {
    letter-spacing: -0.055em;
    text-wrap: balance;
    text-shadow: 0 18px 58px rgba(0, 0, 0, 0.55);
}

.hero-title .highlight {
    background: linear-gradient(105deg, #ff2f25 5%, #ff776e 46%, #ff3b30 70%);
    background-size: 190% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: jpAccentSweep 1.15s cubic-bezier(.16, 1, .3, 1) 180ms both;
}

@keyframes jpAccentSweep {
    from { background-position: 110% 0; filter: brightness(.82); }
    to { background-position: 0 0; filter: brightness(1); }
}

.hero-badge,
.online-counter {
    border: 1px solid rgba(var(--jp-accent-rgb), 0.24);
    background: linear-gradient(135deg, rgba(var(--jp-accent-rgb), 0.09), rgba(10, 10, 12, 0.72));
    box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 12px 36px rgba(0,0,0,.22);
}

.search-bar {
    border-color: rgba(var(--jp-accent-rgb), 0.25) !important;
    background: linear-gradient(145deg, rgba(24, 21, 22, .96), rgba(10, 10, 12, .94)) !important;
    box-shadow: 0 18px 48px rgba(0,0,0,.34), inset 0 1px 0 rgba(255,255,255,.035);
    transition: border-color .28s ease, box-shadow .28s ease, transform .28s cubic-bezier(.16,1,.3,1);
}

.search-bar:focus-within {
    border-color: rgba(var(--jp-accent-rgb), 0.72) !important;
    box-shadow: 0 20px 58px rgba(0,0,0,.42), 0 0 30px rgba(var(--jp-accent-rgb), .13);
    transform: translateY(-2px);
}

/* More coherent glass surfaces across the site. */
:is(.tool-card, .featured-card, .feature-card, .faq-item, .seller-card, .recent-numbers, .tracking-result, .guide-page .info-box, .qc-multi-card, .wishlist-page .card) {
    border-color: rgba(255,255,255,.09) !important;
    background-image:
        linear-gradient(145deg, rgba(255,255,255,.032), transparent 46%),
        radial-gradient(circle at 88% 12%, rgba(var(--jp-accent-rgb), .075), transparent 34%) !important;
    box-shadow: 0 18px 46px rgba(0,0,0,.24), inset 0 1px 0 rgba(255,255,255,.025);
}

@media (hover: hover) and (pointer: fine) {
    :is(.tool-card, .featured-card, .feature-card, .faq-item, .seller-card, .guide-page .info-box, .qc-multi-card, .wishlist-page .card):hover {
        border-color: rgba(var(--jp-accent-rgb), .36) !important;
        box-shadow: 0 24px 64px rgba(0,0,0,.34), 0 0 28px rgba(var(--jp-accent-rgb), .08);
    }

    .jp-magnetic:active {
        transform: translate3d(var(--jp-magnet-x, 0px), var(--jp-magnet-y, 0px), 0) scale(.975) !important;
    }
}

/* Pointer-following light is a real element, not a pseudo-element, so it does
   not collide with legacy card effects. */
.jp-local-glow-host {
    position: relative;
    transform: perspective(900px) rotateX(var(--jp-tilt-x, 0deg)) rotateY(var(--jp-tilt-y, 0deg));
    transform-style: preserve-3d;
    transition: transform .28s cubic-bezier(.16,1,.3,1), border-color .22s ease, box-shadow .22s ease;
}

.jp-card-edge {
    position: absolute;
    z-index: 6;
    top: 0;
    left: 18px;
    right: 18px;
    height: 1px;
    pointer-events: none;
    opacity: .72;
    background: linear-gradient(90deg, transparent, rgba(var(--jp-accent-rgb), .75), transparent);
    box-shadow: 0 0 16px rgba(var(--jp-accent-rgb), .28);
}

/* Block-based tool hierarchy inspired by the selected UI/UX system. */
.tools-grid .tool-card {
    isolation: isolate;
    overflow: hidden;
    min-height: 190px;
}

.tools-grid .tool-card > :not(.jp-local-glow, .jp-card-edge, .jp-tool-index) {
    position: relative;
    z-index: 2;
}

.jp-tool-index {
    position: absolute;
    z-index: 2;
    top: 15px;
    right: 17px;
    color: rgba(255,255,255,.18);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .16em;
    font-variant-numeric: tabular-nums;
}

:is(.featured-header, .features-header) h2::after,
.faq-section > h2::after {
    content: '';
    display: inline-block;
    width: 42px;
    height: 3px;
    margin-left: 14px;
    border-radius: 999px;
    vertical-align: middle;
    background: linear-gradient(90deg, var(--jp-accent), transparent);
    box-shadow: 0 0 16px rgba(var(--jp-accent-rgb), .38);
}

.jp-local-glow {
    position: absolute;
    z-index: 5;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    opacity: 0;
    background: radial-gradient(
        300px circle at var(--jp-glow-x, 50%) var(--jp-glow-y, 50%),
        rgba(var(--jp-accent-rgb), .16),
        rgba(var(--jp-accent-rgb), .045) 38%,
        transparent 70%
    );
    transition: opacity .24s ease;
}

.jp-local-glow-host.jp-glow-visible > .jp-local-glow {
    opacity: 1;
}

/* Native scroll progress. It never captures clicks. */
.jp-local-progress {
    position: fixed;
    z-index: 11000;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    pointer-events: none;
    transform: scaleX(var(--jp-progress, 0));
    transform-origin: left center;
    background: linear-gradient(90deg, #ff241a, #ff7067, #ff3b30);
    box-shadow: 0 0 14px rgba(var(--jp-accent-rgb), .7);
}

/* Keep the native OS cursor and use a separate smooth visual follower. */
body.custom-cursor-active,
body.jp-experience {
    cursor: auto !important;
}

body.custom-cursor-active :is(a, button, [role="button"], label, select, summary),
body.jp-experience :is(a, button, [role="button"], label, select, summary) {
    cursor: pointer !important;
}

body.custom-cursor-active :is(input:not([type]), input[type="text"], input[type="search"], input[type="email"], input[type="number"], input[type="password"], input[type="tel"], input[type="url"], textarea, [contenteditable="true"]),
body.jp-experience :is(input:not([type]), input[type="text"], input[type="search"], input[type="email"], input[type="number"], input[type="password"], input[type="tel"], input[type="url"], textarea, [contenteditable="true"]) {
    cursor: text !important;
}

body.custom-cursor-active :is(input[type="button"], input[type="submit"], input[type="reset"], input[type="checkbox"], input[type="radio"], input[type="range"], input[type="color"], input[type="file"]),
body.jp-experience :is(input[type="button"], input[type="submit"], input[type="reset"], input[type="checkbox"], input[type="radio"], input[type="range"], input[type="color"], input[type="file"]) {
    cursor: pointer !important;
}

#cursor-outline,
#cursor-dot {
    display: none !important;
}

.jp-smooth-cursor {
    --jp-cursor-x: -80px;
    --jp-cursor-y: -80px;
    --jp-cursor-scale: 1;
    position: fixed;
    z-index: 2147483646;
    top: 0;
    left: 0;
    width: 26px;
    height: 26px;
    border: 1.5px solid rgba(var(--jp-accent-rgb), .78);
    border-radius: 999px;
    pointer-events: none;
    opacity: 0;
    transform:
        translate3d(var(--jp-cursor-x), var(--jp-cursor-y), 0)
        translate(-50%, -50%)
        scale(var(--jp-cursor-scale));
    background: rgba(var(--jp-accent-rgb), .025);
    box-shadow: 0 0 18px rgba(var(--jp-accent-rgb), .22);
    transition:
        width .22s cubic-bezier(.16,1,.3,1),
        height .22s cubic-bezier(.16,1,.3,1),
        opacity .18s ease,
        border-color .2s ease,
        background .2s ease,
        box-shadow .2s ease,
        scale .12s ease;
    will-change: transform;
}

.jp-smooth-cursor.is-visible {
    opacity: 1;
}

.jp-smooth-cursor.is-interactive {
    width: 40px;
    height: 40px;
    border-color: rgba(var(--jp-accent-rgb), .98);
    background: rgba(var(--jp-accent-rgb), .09);
    box-shadow: 0 0 24px rgba(var(--jp-accent-rgb), .32);
}

.jp-smooth-cursor.is-pressed {
    --jp-cursor-scale: .72;
}

/* Buttons keep their original shape but feel more tactile. */
:is(.btn-primary, .btn-secondary, .featured-card-btn, .action-btn-main, .qc-submit-btn) {
    transition:
        transform .24s cubic-bezier(.16,1,.3,1),
        box-shadow .24s ease,
        filter .24s ease !important;
}

.jp-magnetic {
    transform: translate3d(var(--jp-magnet-x, 0px), var(--jp-magnet-y, 0px), 0);
    will-change: transform;
}

.jp-magnetic:active {
    transform: translate3d(var(--jp-magnet-x, 0px), var(--jp-magnet-y, 0px), 0) scale(.975);
}

@media (hover: hover) and (pointer: fine) {
    :is(.btn-primary, .featured-card-btn, .action-btn-main, .qc-submit-btn):hover {
        transform: translate3d(var(--jp-magnet-x, 0px), calc(var(--jp-magnet-y, 0px) - 3px), 0);
        box-shadow: 0 16px 38px rgba(var(--jp-accent-rgb), .27) !important;
        filter: brightness(1.06);
    }
}

[data-theme="light"] .jp-ambient-horizon {
    opacity: .5;
}

[data-theme="light"] :is(.tool-card, .featured-card, .feature-card, .faq-item, .seller-card, .recent-numbers, .tracking-result, .guide-page .info-box, .qc-multi-card, .wishlist-page .card) {
    border-color: rgba(20,20,24,.1) !important;
    background-image:
        linear-gradient(145deg, rgba(255,255,255,.8), transparent 50%),
        radial-gradient(circle at 88% 12%, rgba(var(--jp-accent-rgb), .065), transparent 34%) !important;
    box-shadow: 0 16px 42px rgba(48,34,34,.1), inset 0 1px 0 rgba(255,255,255,.8);
}

[data-theme="light"] .jp-tool-index {
    color: rgba(20,20,24,.24);
}

@media (max-width: 768px), (pointer: coarse) {
    .jp-ambient-horizon {
        filter: blur(80px);
        opacity: .7;
    }

    .jp-local-glow,
    .jp-local-progress,
    .jp-smooth-cursor {
        display: none;
    }

    .jp-local-glow-host,
    .jp-magnetic {
        transform: none !important;
    }

    .hero-title {
        letter-spacing: -0.045em;
    }

    .tools-grid .tool-card {
        min-height: 168px;
    }

    :is(.featured-header, .features-header) h2::after,
    .faq-section > h2::after {
        width: 26px;
        margin-left: 9px;
    }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }

    .hero-title .highlight,
    .jafoorrr-header,
    .jafoorrr-header * {
        animation: none !important;
    }

    .jp-local-progress,
    .jp-local-glow,
    .jp-ambient-horizon,
    .jp-smooth-cursor {
        display: none !important;
    }

    :is(.search-bar, .btn-primary, .btn-secondary, .featured-card-btn, .action-btn-main, .qc-submit-btn) {
        transform: none !important;
        transition: none !important;
    }
}
