/* ==============================================
   SCROLLPIXELS LANDING PAGE
   Refactored for Production
   - Accessibility improvements
   - Performance optimizations
   - Reduced motion support
   ============================================== */

/* ==============================================
   0. ACCESSIBILITY & PERFORMANCE FOUNDATIONS
   ============================================== */

/* Respect user preferences for reduced motion */
/* Best Practice: Reduce motion ONLY for decorative/large movement elements */
@media (prefers-reduced-motion: reduce) {

    /* Stop background loops */
    .hero-bg-grid,
    .hero-sphere-back-glow,
    #hero-sphere-container {
        animation: none !important;
        opacity: 0.5 !important;
    }

    /* Stop excessive parallax or large transitions */
    .reveal {
        transition: none !important;
        transform: none !important;
        opacity: 1 !important;
    }

    /* Note: UI Demos (.demo-card) are EXCLUDED so they remain functional */
}

/* Focus visible for keyboard navigation */
:focus-visible {
    outline: 2px solid #7c3aed;
    outline-offset: 2px;
}

/* Remove default focus for mouse users */
:focus:not(:focus-visible) {
    outline: none;
}

/* ==============================================
   1. BASE OVERRIDES FOR LANDING
   ============================================== */
html {
    overflow-x: hidden;
    overflow-y: auto;
    height: auto;
}

.landing-body {
    background-color: #000000;
    color: #ffffff;
    overflow: visible;
    height: auto;
}

/* Security: Prevent image interaction ONLY on decorative images */
.demo-card img,
.showcase-item img,
.mobile-fallback-grid img {
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
}

/* ==============================================
   2. SKIP TO CONTENT (Accessibility)
   ============================================== */
/* Skip to content accessibility link */
.skip-to-content {
    position: absolute;
    top: -104px;
    left: 50%;
    transform: translateX(-50%);
    background: #7c3aed;
    color: #fff;
    padding: 12px 24px;
    border-radius: 0 0 8px 8px;
    z-index: 9999;
    text-decoration: none;
    font-weight: 600;
    transition: top 0.3s ease;
}

.skip-to-content:focus {
    top: 0;
    /* VISIBLE solo con focus */
}

/* ==============================================
   3. HERO SECTION
   ============================================== */
.landing-hero {
    position: relative;
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 0 24px;
    background: #000000;
    overflow: hidden;
    z-index: 1;
}

.hero-bg-grid {
    position: absolute;
    inset: 0;
    background-size: 50px 50px;
    background-image:
        linear-gradient(to right, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    mask-image: radial-gradient(circle at 50% 50%, black 0%, transparent 80%);
    -webkit-mask-image: radial-gradient(circle at 50% 50%, black 0%, transparent 80%);
    z-index: -1;
    animation: pulseGrid 8s ease-in-out infinite alternate;
    will-change: opacity, transform;
}

@keyframes pulseGrid {
    0% {
        opacity: 0.5;
        transform: scale(1);
    }

    100% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

.hero-content {
    max-width: 900px;
    margin-top: -60px;
    position: relative;
    z-index: 2;
}

.badge-wrapper {
    display: inline-flex;
    margin-bottom: 24px;
}

.hero-tagline {
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #a1a1aa;
    /* Improved contrast */
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.03);
    padding: 6px 16px;
    border-radius: 100px;
    backdrop-filter: blur(10px);
}

.hero-title {
    font-size: clamp(2.5rem, 7vw, 6rem);
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -0.04em;
    color: #ffffff;
    margin: 0 0 16px;
}

.hero-subtitle {
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: #ffffff;
    font-weight: 500;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.8), 0 2px 4px rgba(0, 0, 0, 0.8);
    margin: 0 0 32px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

.text-gradient {
    background: linear-gradient(to right, #ffffff 30%, #7c3aed 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-ctas {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
    margin-left: auto;
    margin-right: auto;
}

.glow-effect {
    box-shadow: 0 0 30px rgba(124, 58, 237, 0.3);
}

/* ==============================================
   4. FEATURES SECTION
   ============================================== */
.landing-features {
    padding: 120px 24px;
    max-width: 1200px;
    margin: 0 auto;
    /* Prevent scrollbar jumping */
}

.section-header {
    text-align: center;
    margin-bottom: 100px;
}

.section-label {
    color: #7c3aed;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-size: 0.85rem;
    margin-bottom: 16px;
}

.section-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    color: #ffffff;
}

/* Feature Row Layout */
.feature-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 60px;
    margin-bottom: 160px;
}

.feature-row.reverse {
    flex-direction: row-reverse;
}

.feature-text {
    flex: 1;
    max-width: 480px;
}

.feature-icon-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background: #111;
    border: 1px solid #222;
    border-radius: 12px;
    margin-bottom: 24px;
    color: #fff;
}

.feature-text h3 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: #ffffff;
}

.feature-text p {
    font-size: 1.1rem;
    color: #a1a1aa;
    /* Improved contrast */
    line-height: 1.6;
    margin-bottom: 32px;
}

.feature-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 4px;
    transition: all 0.2s ease;
}

.feature-link:hover,
.feature-link:focus-visible {
    color: #7c3aed;
    border-color: #7c3aed;
    gap: 12px;
}

.feature-demo {
    flex: 1;
    display: flex;
    justify-content: center;
}

/* Demo Card Base */
.demo-card {
    width: 100%;
    max-width: 500px;
    height: 420px;
    background: #000;
    border-radius: 20px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
}

/* ==============================================
   5. GENERATOR DEMO (Real UI Simulation)
   ============================================== */
.demo-real-ui {
    display: flex;
    flex-direction: column;
    font-family: 'Inter', sans-serif;
}

.mini-app-bg {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 0%, #1f1f2e 0%, #050508 100%);
    z-index: -1;
}

/* Mini Header */
.mini-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.mini-btn-icon {
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
}

.mini-credits-pill {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 100px;
    padding: 4px 10px;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 700;
    color: white;
}

/* Chat Area */
.mini-chat-area {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow: hidden;
    position: relative;
    justify-content: flex-end;
}

/* Message Bubbles */
.mini-message {
    opacity: 0;
    transform: translateY(10px);
}

.user-bubble {
    align-self: flex-end;
    background: #7c3aed;
    color: white;
    padding: 0px 14px;
    border-radius: 16px 16px 2px 16px;
    font-size: 0.8rem;
    max-width: 80%;
    box-shadow: 0 4px 10px rgba(124, 58, 237, 0.2);
}

.demo-real-ui.playing .user-bubble {
    animation: popInUser 8s infinite;
    animation-fill-mode: forwards;
}

/* AI Card */
.ai-card {
    align-self: flex-start;
    background: rgba(20, 20, 30, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    width: 240px;
    backdrop-filter: blur(5px);
    overflow: hidden;
    flex-shrink: 0;
}

.demo-real-ui.playing .ai-card {
    animation: popInAI 8s infinite;
    animation-fill-mode: forwards;
}

.mini-card-image {
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    position: relative;
    overflow: hidden;
}

.mini-final-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
}

.demo-real-ui.playing .mini-final-image {
    animation: fadeInImage 8s infinite;
}

/* Loader */
.mini-loader-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: radial-gradient(circle, #222 0%, #111 100%);
}

.demo-real-ui.playing .mini-loader-overlay {
    animation: fadeOutLoader 8s infinite;
}

.mini-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top-color: #7c3aed;
    border-radius: 50%;
}

.demo-real-ui.playing .mini-spinner {
    animation: spinMini 1s linear infinite;
}

.mini-loader-overlay span {
    font-size: 10px;
    color: #a1a1aa;
}

.mini-card-actions {
    height: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 10px;
}

.mini-action-btn {
    width: 30px;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

/* Floating Dock */
.mini-dock {
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 10;
}

.mini-pills {
    display: flex;
    gap: 6px;
    opacity: 0;
    transform: translateY(10px);
    animation: slideUpPills 8s infinite;
}

.mini-pill {
    font-size: 12px;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #a1a1aa;
}

.mini-pill.active {
    background: #7c3aed;
    color: white;
}

.mini-prompt-bar {
    width: 95%;
    height: 40px;
    background: rgba(30, 30, 40, 0.8);
    backdrop-filter: blur(10px);
    border-radius: 25px;
    display: flex;
    align-items: center;
    padding: 7px 6px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.mini-input-wrapper {
    flex: 1;
    margin-left: 12px;
    height: 100%;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.typing-text {
    font-size: 12px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    width: 0;
    opacity: 1;
}

.demo-real-ui.playing .typing-text {
    animation: typingReal 8s infinite steps(40, end);
}

.mini-gen-btn {
    width: 30px;
    height: 30px;
    background: #333;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    flex-shrink: 0;
}

.demo-real-ui.playing .mini-gen-btn {
    animation: activateBtn 8s infinite;
}

/* ==============================================
   6. GENERATOR DEMO KEYFRAMES
   Timeline (8s total):
   0-20%: Typing prompt
   20-22%: Button activates
   22-25%: Text fades from input
   25-30%: User bubble appears
   30-35%: AI card appears with loader
   50-55%: Loader fades, image appears
   90-100%: Reset
   ============================================== */
@keyframes typingReal {
    0% {
        width: 0;
        opacity: 1;
    }

    /* Typing from 0-20% */
    20% {
        width: 100%;
        opacity: 1;
    }

    /* Hold while button clicks */
    24% {
        width: 100%;
        opacity: 1;
    }

    /* Text disappears after send */
    25% {
        width: 100%;
        opacity: 0;
    }

    /* Stay hidden */
    92% {
        width: 0;
        opacity: 0;
    }

    /* Reset for loop */
    100% {
        width: 0;
        opacity: 1;
    }
}

@keyframes activateBtn {

    /* Inactive only at very start */
    0% {
        background: #333;
        color: #666;
        transform: scale(1);
    }

    /* Activate immediately when typing starts */
    1%,
    19% {
        background: #7c3aed;
        color: #fff;
        transform: scale(1);
    }

    /* Click animation */
    20% {
        background: #7c3aed;
        color: #fff;
        transform: scale(1);
    }

    22% {
        background: #7c3aed;
        color: #fff;
        transform: scale(0.9);
    }

    /* Release */
    25% {
        background: #333;
        color: #666;
        transform: scale(1);
    }

    /* Stay inactive */
    100% {
        background: #333;
        color: #666;
        transform: scale(1);
    }
}

@keyframes popInUser {

    /* Hidden during typing */
    0%,
    24% {
        opacity: 0;
        transform: translateY(10px) scale(0.9);
    }

    /* Appear after button click */
    28% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    /* Stay visible */
    88% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    /* Fade out for reset */
    94% {
        opacity: 0;
        transform: translateY(-5px);
    }

    100% {
        opacity: 0;
    }
}

@keyframes popInAI {

    /* Hidden while user bubble appears */
    0%,
    29% {
        opacity: 0;
        transform: translateY(10px);
    }

    /* Appear after user bubble */
    34% {
        opacity: 1;
        transform: translateY(0);
    }

    /* Stay visible */
    88% {
        opacity: 1;
        transform: translateY(0);
    }

    /* Fade out for reset */
    94% {
        opacity: 0;
        transform: translateY(-5px);
    }

    100% {
        opacity: 0;
    }
}

@keyframes fadeOutLoader {

    /* Loader visible when AI card appears */
    0%,
    29% {
        opacity: 0;
    }

    /* Show loader */
    30% {
        opacity: 1;
    }

    /* Keep loading */
    48% {
        opacity: 1;
    }

    /* Fade out loader */
    52% {
        opacity: 0;
    }

    100% {
        opacity: 0;
    }
}

@keyframes fadeInImage {

    /* Hidden during loading */
    0%,
    48% {
        opacity: 0;
        transform: scale(1.05);
    }

    /* Image reveals after loading */
    54% {
        opacity: 1;
        transform: scale(1);
    }

    /* Stay visible */
    88% {
        opacity: 1;
        transform: scale(1);
    }

    /* Fade for reset */
    94% {
        opacity: 0;
        transform: scale(1);
    }

    100% {
        opacity: 0;
        transform: scale(1.05);
    }
}

@keyframes slideUpPills {

    0%,
    1% {
        opacity: 0;
        transform: translateY(5px);
    }

    5% {
        opacity: 1;
        transform: translateY(0);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spinMini {
    to {
        transform: rotate(360deg);
    }
}




/* ==============================================
   8. UPSCALE DEMO
   ============================================== */
.demo-upscale-simple {
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    border-radius: 12px;
    cursor: ew-resize;
}

.simple-compare-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.mini-compare-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mini-img-after {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-right: 2px solid rgba(255, 255, 255, 0.9);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5);
    z-index: 10;
    clip-path: inset(0 50% 0 0);
}

.mini-img-after img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mini-slider-handle.simple {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 4px;
    background: #ffffff;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.mini-handle-circle {
    display: none;
}

/* Labels */
.label-floating {
    position: absolute;
    bottom: 20px;
    background: rgba(0, 0, 0, 0.4);
    padding: 6px 14px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    pointer-events: none;
    white-space: nowrap;
}

.label-up {
    left: 20px;
    z-index: 25;
}

.label-orig {
    right: 20px;
    z-index: 5;
}

/* ==============================================
   9. MOTION DEMO
   ============================================== */
.demo-motion-video {
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    border-radius: 12px;
}

.motion-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    cursor: default;
}

/* ==============================================
   10. COMMUNITY HERO CARD
   ============================================== */
.feature-card-hero {
    background: transparent;
    border-radius: 24px;
    overflow: hidden;
    display: flex;
    flex-direction: row;
    align-items: center;
    height: 500px;
    grid-column: 1 / -1;
    border: 1px solid transparent;
    transition: border-color 0.3s ease;
}

.feature-card-hero:hover {
    border-color: none;
}

.feature-card-hero .boxed-content {
    flex: 1;
    padding: 60px;
    z-index: 2;
}

.feature-card-hero .boxed-demo {
    flex: 1.5;
    height: 100%;
    min-height: 440px;
    border-top: none;
    background: radial-gradient(circle at center, #111 0%, #000 80%);
    position: relative;
}

.boxed-content {
    padding: 32px;
}

.boxed-content h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: #ffffff;
}

.boxed-content p {
    color: #a1a1aa;
    line-height: 1.6;
    margin-bottom: 24px;
}

.feature-icon-box.small {
    width: 40px;
    height: 40px;
    margin-bottom: 20px;
}

/* Three.js Sphere Container */
.demo-three-sphere {
    overflow: hidden;
    background: radial-gradient(circle at center, #111 0%, #000 70%);
    position: relative;
}

/* Mobile Fallback Grid */
.mobile-fallback-grid {
    display: none;
}

/* ==============================================
   11. CTA SECTION
   ============================================== */
.landing-cta {
    padding: 120px 24px;
    background: #000000;
    display: flex;
    justify-content: center;
}

.cta-container {
    text-align: center;
    max-width: 600px;
    position: relative;
}

.cta-container::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    background: #7c3aed;
    filter: blur(120px);
    opacity: 0.2;
    z-index: -1;
}

.cta-title {
    font-size: clamp(2rem, 5vw, 4rem);
    font-weight: 700;
    margin-bottom: 16px;
    color: #fff;
}

.btn-xl {
    padding: 16px 40px;
    font-size: 1.1rem;
    border-radius: 100px;
}

/* ==============================================
   12. SCROLL REVEAL ANIMATIONS
   ============================================== */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: all 0.8s ease;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

.reveal-delay-1 {
    transition-delay: 0.1s;
}

.reveal-delay-2 {
    transition-delay: 0.2s;
}

.reveal-delay-3 {
    transition-delay: 0.3s;
}

/* ==============================================
   13. RESPONSIVE DESIGN
   ============================================== */
@media (max-width: 900px) {

    .feature-row,
    .feature-row.reverse {
        flex-direction: column;
        align-items: flex-start;
        gap: 40px;
    }

    .feature-text {
        max-width: 100%;
    }

    .feature-demo {
        width: 100%;
    }

    .landing-features {
        padding: 60px 16px;
    }

    .feature-row {
        margin-bottom: 80px;
    }

    .feature-dual-grid {
        grid-template-columns: 1fr;
    }

    .feature-card-hero {
        flex-direction: column;
        height: auto;
        overflow: visible;
    }

    .feature-card-hero .boxed-demo {
        height: auto;
        min-height: auto;
        overflow: visible;
        padding: 0;
    }

    .feature-card-hero .boxed-content {
        padding: 32px;
    }

    /* Show Three.js sphere on mobile */
    .demo-three-sphere canvas {
        display: block !important;
    }

    /* Show mobile fallback */
    .mobile-fallback-grid {
        display: block !important;
        column-count: 3;
        column-gap: 8px;
        padding: 16px;
        padding-bottom: 0;
        overflow: visible;
        position: relative;
    }

    .mobile-fallback-grid::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 80px;
        background: linear-gradient(to bottom, transparent 0%, #000 100%);
        pointer-events: none;
        z-index: 10;
    }

    .mobile-fallback-grid img {
        width: 100%;
        margin-bottom: 8px;
        object-fit: cover;
        border-radius: 8px;
        break-inside: avoid;
    }

    /* Hero adjustments */
    .hero-content {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        width: 100%;
    }

    .hero-ctas {
        display: flex;
        flex-direction: column;
        width: 100%;
        max-width: 300px;
        gap: 16px;
    }

    .hero-ctas .btn {
        width: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
    }
}

/* ==============================================
   14. PRINT STYLES
   ============================================== */
@media print {

    .landing-hero,
    .demo-card,
    .hero-bg-grid,
    #hero-sphere-container {
        display: none !important;
    }

    .landing-features {
        padding: 20px;
    }

    .feature-demo {
        display: none;
    }
}