/* ==========================================================================
   KUAITECH - Scrolling Narrative Preview Stylesheet
   Design Inspiration: Linear, Raycast, Stripe (Dark Canvas, Sticky Stacking, Bento Grid)
   ========================================================================== */

:root {
    --sp-bg: #080b16;
    --sp-bg-card: rgba(11, 16, 30, 0.65);
    --sp-bg-card-hover: rgba(16, 23, 44, 0.85);
    --sp-border: rgba(56, 189, 248, 0.15);
    --sp-border-hover: rgba(56, 189, 248, 0.5);
    --sp-primary: #8b5cf6;
    --sp-primary-glow: rgba(139, 92, 246, 0.35);
    --sp-cyan: #38bdf8;
    --sp-emerald: #10b981;
    --sp-amber: #f59e0b;
    --sp-text: #f8fafc;
    --sp-muted: #94a3b8;
    --sp-mono: 'JetBrains Mono', monospace;
}

body.scrolling-preview {
    background-color: var(--sp-bg);
    background-image: 
        radial-gradient(ellipse at 50% 10%, rgba(56, 189, 248, 0.16) 0%, transparent 60%),
        radial-gradient(ellipse at 85% 65%, rgba(139, 92, 246, 0.14) 0%, transparent 50%),
        linear-gradient(rgba(56, 189, 248, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(56, 189, 248, 0.04) 1px, transparent 1px);
    background-size: 100% 100%, 100% 100%, 54px 54px, 54px 54px;
    color: var(--sp-text);
    overflow-x: hidden;
    position: relative;
}



/* Fixed 3D Dynamic Canvas Background (Reacts to Scroll & Movement) */
#sp-dynamic-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 0;
}

/* Subtle Perspective Grid Overlay */
.sp-grid-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 0;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 64px 64px;
    mask-image: radial-gradient(ellipse at 50% 50%, black 20%, transparent 80%);
    -webkit-mask-image: radial-gradient(ellipse at 50% 50%, black 20%, transparent 80%);
    opacity: 0.7;
    transform: perspective(600px) rotateX(15deg);
    transform-origin: center top;
    transition: transform 0.1s ease-out;
}

/* Scroll Progress Bar at the Very Top */
.sp-scroll-tracker {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, #8b5cf6, #38bdf8, #10b981);
    z-index: 9999;
    width: 0%;
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.8);
    transition: width 0.05s ease-out;
}

/* Hero Section */
.sp-hero {
    position: relative;
    padding: 160px 0 80px;
    text-align: center;
    z-index: 1;
}

.sp-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 9999px;
    font-size: 13px;
    font-weight: 600;
    color: #c084fc;
    margin-bottom: 24px;
    letter-spacing: 0.02em;
    backdrop-filter: blur(8px);
}

.sp-badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--sp-emerald);
    box-shadow: 0 0 10px var(--sp-emerald);
    animation: sp-pulse 2s infinite ease-in-out;
}

@keyframes sp-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.85); }
}

.sp-hero-title {
    font-size: clamp(38px, 6vw, 68px);
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -0.03em;
    max-width: 950px;
    margin: 0 auto 24px;
    color: #ffffff;
}

.sp-hero-title span.sp-gradient-text {
    background: linear-gradient(135deg, #ffffff 30%, #c084fc 70%, #38bdf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

.sp-hero-subtitle {
    font-size: clamp(16px, 2vw, 20px);
    color: var(--sp-muted);
    max-width: 680px;
    margin: 0 auto 40px;
    line-height: 1.6;
}

.sp-hero-cta-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 60px;
    flex-wrap: wrap;
}

.sp-btn-glow {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    background: linear-gradient(135deg, #7c3aed 0%, #6366f1 100%);
    color: #ffffff !important;
    font-weight: 600;
    font-size: 15px;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 24px rgba(124, 58, 237, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.sp-btn-glow:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(124, 58, 237, 0.6);
    background: linear-gradient(135deg, #8b5cf6 0%, #4f46e5 100%);
}

.sp-btn-subtle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 26px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--sp-border);
    color: #e2e8f0 !important;
    font-weight: 500;
    font-size: 15px;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.2s ease;
    backdrop-filter: blur(8px);
}

.sp-btn-subtle:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    color: #ffffff !important;
}

/* Interactive Terminal Mockup */
.sp-terminal-wrapper {
    max-width: 820px;
    margin: 0 auto;
    perspective: 1000px;
}

.sp-terminal {
    background: rgba(11, 12, 18, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    box-shadow: 0 24px 70px -15px rgba(0, 0, 0, 0.85), 0 0 50px rgba(139, 92, 246, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    overflow: hidden;
    text-align: left;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
}

.sp-terminal-header {
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding: 12px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sp-terminal-dots {
    display: flex;
    gap: 8px;
}

.sp-terminal-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.sp-dot-red { background: #ef4444; }
.sp-dot-yellow { background: #f59e0b; }
.sp-dot-green { background: #10b981; }

.sp-terminal-title {
    font-family: var(--sp-mono);
    font-size: 12px;
    color: var(--sp-muted);
}

.sp-terminal-badge {
    font-size: 11px;
    background: rgba(56, 189, 248, 0.1);
    color: var(--sp-cyan);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: var(--sp-mono);
}

.sp-terminal-body {
    padding: 20px;
    font-family: var(--sp-mono);
    font-size: 13px;
    line-height: 1.8;
    color: #cbd5e1;
    min-height: 190px;
}

.sp-term-line {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.sp-term-prompt {
    color: #8b5cf6;
    user-select: none;
}

.sp-term-success {
    color: #10b981;
}

.sp-term-accent {
    color: #38bdf8;
}

.sp-term-muted {
    color: #64748b;
}

/* ==========================================================================
   SECTION: STICKY CARDS (CARD STACKING ON SCROLL)
   ========================================================================== */
.sp-stack-section {
    position: relative;
    padding: 100px 0;
    z-index: 2;
}

.sp-section-heading {
    text-align: center;
    max-width: 680px;
    margin: 0 auto 60px;
}

.sp-section-tag {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--sp-primary);
    margin-bottom: 12px;
    display: block;
}

.sp-section-title {
    font-size: clamp(28px, 4vw, 44px);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #ffffff;
    margin-bottom: 16px;
    line-height: 1.15;
}

.sp-section-desc {
    color: var(--sp-muted);
    font-size: 16px;
    line-height: 1.6;
}

.sp-stack-container {
    display: flex;
    flex-direction: column;
    gap: 32px;
    position: relative;
    max-width: 1000px;
    margin: 0 auto;
}

.sp-stack-card {
    position: sticky;
    background: rgba(12, 13, 20, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 24px;
    padding: 48px;
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Sticky offsets so each card peeks nicely over the previous */
.sp-stack-card:nth-child(1) {
    top: 100px;
    border-top: 1px solid rgba(139, 92, 246, 0.4);
}

.sp-stack-card:nth-child(2) {
    top: 130px;
    border-top: 1px solid rgba(56, 189, 248, 0.4);
}

.sp-stack-card:nth-child(3) {
    top: 160px;
    border-top: 1px solid rgba(16, 185, 129, 0.4);
}

.sp-card-content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
}

.sp-card-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 16px;
}

.sp-card-title {
    font-size: 28px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 16px;
    line-height: 1.25;
}

.sp-card-text {
    font-size: 15px;
    color: var(--sp-muted);
    line-height: 1.7;
    margin-bottom: 24px;
}

.sp-card-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sp-card-pill {
    font-size: 12px;
    padding: 5px 12px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
}

.sp-card-visual {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Visual UI Cards inside Stacking */
.sp-sim-metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.sp-sim-metric-label {
    font-size: 13px;
    color: var(--sp-muted);
}

.sp-sim-metric-val {
    font-family: var(--sp-mono);
    font-weight: 700;
    font-size: 15px;
}

/* ==========================================================================
   SECTION: BENTO GRID
   ========================================================================== */
.sp-bento-section {
    position: relative;
    padding: 100px 0;
    z-index: 2;
}

.sp-bento-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 24px;
    max-width: 1100px;
    margin: 0 auto;
}

.sp-bento-item {
    background: rgba(12, 13, 20, 0.70);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 32px;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.sp-bento-item:hover {
    border-color: var(--sp-border-hover);
    transform: translateY(-4px);
    box-shadow: 0 16px 36px -10px rgba(139, 92, 246, 0.3);
}

.sp-col-8 { grid-column: span 8; }
.sp-col-4 { grid-column: span 4; }
.sp-col-6 { grid-column: span 6; }
.sp-col-12 { grid-column: span 12; }

.sp-bento-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 20px;
}

.sp-bento-title {
    font-size: 20px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 12px;
}

.sp-bento-desc {
    font-size: 14px;
    color: var(--sp-muted);
    line-height: 1.6;
}

/* Workflow Steps inside Bento (Responsive Grid, No Horizontal Scroll) */
.sp-workflow-pipeline {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-top: 24px;
    padding: 16px;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    overflow: visible;
}

.sp-wf-node {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: #f1f5f9;
    transition: all 0.2s ease;
}

.sp-wf-node:hover {
    border-color: rgba(56, 189, 248, 0.4);
    background: rgba(56, 189, 248, 0.08);
    transform: translateY(-2px);
}

.sp-wf-arrow {
    display: none;
}

/* Interactive Before / After Switch */
.sp-compare-toggle {
    display: inline-flex;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--sp-border);
    border-radius: 9999px;
    padding: 4px;
    margin: 20px 0;
}

.sp-toggle-btn {
    padding: 8px 18px;
    border-radius: 9999px;
    border: none;
    background: transparent;
    color: var(--sp-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sp-toggle-btn.active {
    background: var(--sp-primary);
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(139, 92, 246, 0.4);
}

.sp-compare-box {
    padding: 16px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 14px;
    line-height: 1.6;
}

/* Interactive Counters */
.sp-counter-value {
    font-size: 40px;
    font-weight: 800;
    color: #ffffff;
    font-family: var(--sp-mono);
    line-height: 1;
    margin-bottom: 8px;
}

/* ==========================================================================
   SECTION: FAQS ACCORDION
   ========================================================================== */
.sp-faq-section {
    padding: 80px 0;
    max-width: 800px;
    margin: 0 auto;
}

.sp-faq-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sp-faq-card {
    background: var(--sp-bg-card);
    border: 1px solid var(--sp-border);
    border-radius: 16px;
    overflow: hidden;
    transition: border-color 0.2s ease;
}

.sp-faq-card:hover {
    border-color: rgba(255, 255, 255, 0.16);
}

.sp-faq-trigger {
    width: 100%;
    padding: 22px 24px;
    background: none;
    border: none;
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.sp-faq-icon {
    font-size: 18px;
    transition: transform 0.3s ease;
    color: var(--sp-muted);
}

.sp-faq-card.open .sp-faq-icon {
    transform: rotate(180deg);
    color: var(--sp-primary);
}

.sp-faq-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding: 0 24px;
    color: var(--sp-muted);
    font-size: 15px;
    line-height: 1.7;
}

.sp-faq-card.open .sp-faq-content {
    max-height: 250px;
    padding-bottom: 24px;
}

/* ==========================================================================
   SECTION: INLINE CONTACT FORM (Dark Glassmorphic & Mobile-Optimized)
   ========================================================================== */
.sp-contact-section {
    padding: 90px 0 130px;
    position: relative;
    z-index: 2;
}

.sp-contact-card {
    max-width: 820px;
    margin: 0 auto;
    padding: 48px 42px;
    background: linear-gradient(180deg, rgba(16, 23, 44, 0.88) 0%, rgba(8, 11, 22, 0.96) 100%);
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-radius: 24px;
    box-shadow: 0 0 60px rgba(56, 189, 248, 0.12), 0 24px 48px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(20px);
}

.sp-contact-header {
    text-align: center;
    margin-bottom: 36px;
}

.sp-contact-title {
    font-size: clamp(28px, 4.5vw, 42px);
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 12px;
    line-height: 1.2;
}

.sp-contact-desc {
    color: var(--sp-muted);
    font-size: 16px;
    max-width: 580px;
    margin: 0 auto;
    line-height: 1.6;
}

.sp-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.sp-form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
}

.sp-form-group.full-width {
    grid-column: span 2;
}

.sp-form-label {
    font-size: 13px;
    font-weight: 600;
    color: #cbd5e1;
    letter-spacing: 0.01em;
}

.sp-form-label span.req {
    color: #f43f5e;
}

.sp-form-input,
.sp-form-select,
.sp-form-textarea {
    width: 100%;
    background: rgba(4, 7, 15, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 14px 16px;
    color: #ffffff;
    font-family: inherit;
    font-size: 15px;
    outline: none;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.sp-form-input:focus,
.sp-form-select:focus,
.sp-form-textarea:focus {
    border-color: #38bdf8;
    background: rgba(8, 14, 28, 0.95);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.sp-form-select option {
    background: #0b101e;
    color: #ffffff;
}

.sp-form-textarea {
    resize: vertical;
    min-height: 120px;
}

.sp-form-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 20px 0 28px;
    text-align: left;
    font-size: 13px;
    color: var(--sp-muted);
}

.sp-form-check input[type="checkbox"] {
    margin-top: 3px;
    accent-color: #38bdf8;
    cursor: pointer;
    width: 16px;
    height: 16px;
}

.sp-form-check a {
    color: #38bdf8;
    text-decoration: underline;
}

.sp-btn-submit {
    width: 100%;
    padding: 16px 28px;
    background: linear-gradient(135deg, #38bdf8 0%, #8b5cf6 100%);
    border: none;
    border-radius: 12px;
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(56, 189, 248, 0.35);
}

.sp-btn-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(139, 92, 246, 0.5);
}

.sp-btn-submit:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.sp-contact-guarantees {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 24px;
    font-size: 13px;
    color: var(--sp-muted);
    flex-wrap: wrap;
}

.sp-contact-guarantees span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sp-contact-guarantees i {
    color: #10b981;
}

/* ==========================================================================
   RESPONSIVE DESIGN (TABLETS & PHONES)
   ========================================================================== */
@media (max-width: 900px) {
    .sp-card-content-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .sp-col-8, .sp-col-4, .sp-col-6 {
        grid-column: span 12;
    }

    .sp-workflow-pipeline {
        grid-template-columns: repeat(2, 1fr);
    }

    .sp-stack-card {
        padding: 32px 24px;
        position: relative;
        top: 0 !important;
    }

    .sp-hero {
        padding: 120px 0 60px;
    }
}

@media (max-width: 640px) {
    .sp-workflow-pipeline {
        grid-template-columns: 1fr;
    }

    .sp-contact-card {
        padding: 32px 20px;
        border-radius: 20px;
    }

    .sp-form-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .sp-form-group.full-width {
        grid-column: span 1;
    }

    .sp-contact-guarantees {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
}
