/**
 * VISARJ DCBx Scroll-Jacking Animation Styles
 * Section pinning with component transitions
 */

/* Prevent horizontal overflow globally */
.dcbx-scroll-section,
.dcbx-scroll-section *,
.dcbx-pinned-container,
.dcbx-content-grid,
.dcbx-visual-panel,
.dcbx-info-panel,
.pod-container,
.pod-static-image,
.content-panel {
    max-width: 100%;
    box-sizing: border-box;
}

/* Aggressive overflow control */
body {
    overflow-x: hidden;
}

html, body {
    max-width: 100%;
    overflow-x: hidden;
}

/* Main Section */
.dcbx-scroll-section {
    position: relative;
    width: 100%;
    /* Height will be calculated by JavaScript */
    min-height: 300vh;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    overflow-x: hidden; /* Prevent horizontal scrolling */
    overflow-y: visible; /* Allow vertical scrolling */
}

/* When animation is complete, reduce z-index so next section flows normally */
.dcbx-scroll-section.animation-complete {
    z-index: 1;
}

.dcbx-scroll-section.is-pinned {
    z-index: 10;
}

/* Pinned Container */
.dcbx-pinned-container {
    position: sticky;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.dcbx-scroll-section.is-pinned .dcbx-pinned-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
}

/* When animation is complete, allow section to scroll away normally */
.dcbx-scroll-section.animation-complete .dcbx-pinned-container {
    position: relative;
    z-index: 1;
}

/* Ensure next section can flow over completed animation */
.dcbx-scroll-section.animation-complete + * {
    position: relative;
    z-index: 5;
}

/* Content Grid */
.dcbx-content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    max-width: 1400px;
    width: 90%;
    margin: 0 auto;
    padding: 40px 20px;
    box-sizing: border-box;
    overflow: hidden; /* Prevent content overflow */
}

/* Left Panel: Visual */
.dcbx-visual-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.dcbx-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    text-align: center;
    width: 100%;
}

.dcbx-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 40px;
    text-align: center;
    width: 100%;
}

/* Pod Container - wraps pod image and component stages */
.pod-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    margin: 0 auto 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Static Pod Image */
.pod-static-image {
    position: relative;
    width: 100%;
    max-width: 100%;
    height: auto;
    z-index: 1;
}

.pod-static-image img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    border: 2px solid var(--primary-color);
}

/* Component Stages (Overlays on Pod) */
.component-stage {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.5);
    opacity: 0;
    transition: all 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 2;
    pointer-events: none;
    max-width: 90%;
    background: transparent !important;
    /* GPU acceleration for smoother transitions */
    will-change: transform, opacity;
    backface-visibility: hidden;
}

.component-stage.active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    z-index: 10;
}

/* Stage 1: Empty Pod (No overlay, just label) */
.stage-1 .component-overlay {
    padding: 20px 40px;
    background: rgba(59, 130, 246, 0.15);
    border: 2px solid var(--primary-color);
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.component-label {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--primary-color);
    text-align: center;
}

/* Stages 2-5: Component Images */
.component-image {
    position: relative;
    background: transparent !important;
}

.component-image img {
    max-width: 300px;
    height: auto;
    border-radius: 0;
    box-shadow: 0 8px 30px rgba(0,0,0,0.6);
    border: 3px solid transparent;
    transition: all 0.4s ease;
    background: transparent;
    object-fit: contain;
    /* GPU acceleration for smoother animations */
    transform: translateZ(0);
    will-change: transform, opacity;
    backface-visibility: hidden;
}

.stage-2.active .component-image img {
    border-color: transparent;
    box-shadow: 0 8px 30px rgba(59, 130, 246, 0.5), 0 0 40px rgba(59, 130, 246, 0.3);
}

.stage-3.active .component-image img {
    border-color: #8b5cf6;
    box-shadow: 0 8px 30px rgba(139, 92, 246, 0.5), 0 0 40px rgba(139, 92, 246, 0.3);
}

.stage-4.active .component-image img {
    border-color: #3b82f6;
    box-shadow: 0 8px 30px rgba(59, 130, 246, 0.5);
    max-width: 210px; /* 30% smaller than default 300px */
}

.stage-5.active .component-image img {
    border-color: #06b6d4;
    box-shadow: 0 8px 30px rgba(6, 182, 212, 0.5);
}

.stage-6.active .component-image img {
    border-color: #10b981;
    box-shadow: 0 8px 30px rgba(16, 185, 129, 0.5);
}

/* Progress Indicator */
.dcbx-progress {
    width: 100%;
    max-width: 400px;
    margin-top: 30px;
    text-align: center;
}

.dcbx-progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.dcbx-progress-fill {
    width: 20%;
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 10px;
    transition: width 0.8s ease;
}

.dcbx-progress-text {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Right Panel: Information */
.dcbx-info-panel {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Content Panels */
.content-panel {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%) translateX(50px);
    opacity: 0;
    transition: all 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 50px;
    border: 2px solid rgba(59, 130, 246, 0.3);
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    pointer-events: none;
}

.content-panel.active {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
    pointer-events: auto;
}

.panel-number {
    display: inline-block;
    font-size: 3rem;
    font-weight: 800;
    color: var(--primary-color);
    opacity: 0.3;
    margin-bottom: 10px;
}

.content-panel h3 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.content-panel p {
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.feature-list {
    list-style: none;
    padding: 0;
    margin: 0 0 30px 0;
}

.feature-list li {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.feature-list li i {
    color: var(--secondary-color);
    font-size: 1.2rem;
}

/* Final CTA Buttons */
.cta-final {
    display: flex;
    gap: 20px;
    margin-top: 30px;
}

.cta-final .btn {
    flex: 1;
    padding: 14px 24px;
    text-align: center;
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .dcbx-content-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        width: 95%;
        padding: 20px 10px;
    }
    
    .dcbx-title {
        font-size: 1.8rem;
    }
    
    .dcbx-info-panel {
        position: relative;
        min-height: 400px;
        width: 100%;
    }
    
    .content-panel {
        position: relative;
        top: auto;
        left: auto;
        right: auto;
        transform: translateY(0);
        padding: 30px 20px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .content-panel.active {
        transform: translateY(0);
    }
    
    .component-image img {
        max-width: 200px;
    }
}

@media (max-width: 768px) {
    .dcbx-scroll-section {
        overflow-x: hidden !important;
    }
    
    .dcbx-pinned-container {
        padding: 10px;
        height: auto !important;
        min-height: auto;
        max-height: 100vh;
        overflow: hidden;
        width: 100%;
        box-sizing: border-box;
        display: flex;
        align-items: flex-start;
    }
    
    .dcbx-content-grid {
        width: 100%;
        max-width: 100%;
        padding: 5px;
        gap: 10px;
        overflow: hidden;
        box-sizing: border-box;
        max-height: 100vh;
        display: flex;
        flex-direction: column;
    }
    
    .dcbx-visual-panel {
        width: 100%;
        max-width: 100%;
        overflow: hidden;
        padding: 0;
        box-sizing: border-box;
        flex-shrink: 0;
    }
    
    .dcbx-title {
        font-size: 1.2rem;
        padding: 0 10px;
        margin-bottom: 5px;
    }
    
    .dcbx-subtitle {
        font-size: 0.8rem;
        padding: 0 10px;
        margin-bottom: 10px;
    }
    
    .pod-container {
        max-width: 100%;
        width: 100%;
        padding: 0;
        margin: 0 auto 10px;
        overflow: hidden;
        box-sizing: border-box;
    }
    
    .pod-static-image {
        max-width: 100%;
        width: 100%;
        margin: 0;
        padding: 0;
        overflow: hidden;
    }
    
    .pod-static-image img {
        width: 100%;
        max-width: 100%;
        height: auto;
        display: block;
    }
    
    /* Component stages - make MUCH smaller for mobile */
    .component-stage {
        max-width: 60%;
    }
    
    .component-stage.active {
        transform: translate(-50%, -50%) scale(0.5);
    }
    
    /* Stage 1 label */
    .stage-1 .component-overlay {
        padding: 8px 12px;
    }
    
    .component-label {
        font-size: 0.8rem;
        white-space: nowrap;
    }
    
    .component-image {
        max-width: 100%;
    }
    
    .component-image img {
        max-width: 120px;
        width: 100%;
        height: auto;
        display: block;
    }
    
    .dcbx-info-panel {
        width: 100%;
        max-width: 100%;
        overflow: hidden;
        box-sizing: border-box;
        position: relative;
        min-height: 200px;
        max-height: 40vh;
        flex-shrink: 1;
        overflow-y: auto;
    }
    
    .content-panel {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        transform: none !important;
        padding: 12px 10px;
        margin: 0;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        border-radius: 8px;
        overflow: hidden;
        word-wrap: break-word;
        display: none;
    }
    
    .content-panel.active {
        display: block !important;
        opacity: 1;
        transform: none !important;
    }
    
    .content-panel h3 {
        font-size: 1.1rem;
        word-wrap: break-word;
        line-height: 1.2;
        margin-bottom: 8px;
    }
    
    .content-panel p {
        font-size: 0.85rem;
        line-height: 1.4;
        margin-bottom: 8px;
    }
    
    .panel-number {
        font-size: 1.5rem;
        margin-bottom: 5px;
    }
    
    .feature-list {
        margin-bottom: 10px;
    }
    
    .feature-list li {
        font-size: 0.8rem;
        gap: 6px;
        word-wrap: break-word;
        margin-bottom: 6px;
    }
    
    .feature-list li i {
        font-size: 0.85rem;
        flex-shrink: 0;
    }
    
    .cta-final {
        flex-direction: column;
        gap: 8px;
    }
    
    .cta-final .btn {
        padding: 8px 12px;
        font-size: 0.8rem;
        width: 100%;
        box-sizing: border-box;
    }
    
    .dcbx-progress {
        max-width: 95%;
        margin: 10px auto 0;
    }
    
    .dcbx-progress-bar {
        height: 5px;
    }
    
    .dcbx-progress-text {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .dcbx-pinned-container {
        padding: 8px 5px;
        overflow: hidden;
        max-height: 100vh;
    }
    
    .dcbx-content-grid {
        width: 100%;
        padding: 5px 3px;
        gap: 8px;
        max-height: 100vh;
    }
    
    .dcbx-title {
        font-size: 1rem;
        line-height: 1.2;
        padding: 0 8px;
        margin-bottom: 3px;
    }
    
    .dcbx-subtitle {
        font-size: 0.7rem;
        padding: 0 8px;
        margin-bottom: 8px;
    }
    
    .pod-container {
        max-width: 100%;
        width: 100%;
        padding: 0;
        margin-bottom: 8px;
    }
    
    .pod-static-image {
        max-width: 100%;
        width: 100%;
    }
    
    .component-stage {
        max-width: 50%;
    }
    
    .component-stage.active {
        transform: translate(-50%, -50%) scale(0.4);
    }
    
    .stage-1 .component-overlay {
        padding: 6px 10px;
    }
    
    .component-label {
        font-size: 0.7rem;
    }
    
    .component-image img {
        max-width: 100px;
    }
    
    .dcbx-info-panel {
        max-height: 35vh;
        min-height: 180px;
    }
    
    .content-panel {
        padding: 10px 8px;
        margin: 0;
        width: 100%;
    }
    
    .content-panel h3 {
        font-size: 0.95rem;
        line-height: 1.2;
        margin-bottom: 6px;
    }
    
    .content-panel p {
        font-size: 0.75rem;
        margin-bottom: 6px;
        line-height: 1.3;
    }
    
    .panel-number {
        font-size: 1.2rem;
        margin-bottom: 3px;
    }
    
    .feature-list {
        margin-bottom: 8px;
    }
    
    .feature-list li {
        font-size: 0.7rem;
        margin-bottom: 5px;
        gap: 4px;
    }
    
    .feature-list li i {
        font-size: 0.75rem;
    }
    
    .cta-final .btn {
        padding: 6px 10px;
        font-size: 0.7rem;
        width: 100%;
    }
    
    .dcbx-progress {
        max-width: 98%;
        margin: 8px auto 0;
    }
    
    .dcbx-progress-bar {
        height: 4px;
    }
    
    .dcbx-progress-text {
        font-size: 0.75rem;
    }
}

/* Scroll Hint Animation */
@keyframes scrollHint {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(10px);
    }
}

.dcbx-scroll-section::after {
    content: '';
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 50px;
    border: 2px solid var(--primary-color);
    border-radius: 20px;
    opacity: 0.6;
}

.dcbx-scroll-section::before {
    content: '';
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 10px;
    background: var(--primary-color);
    border-radius: 3px;
    animation: scrollHint 2s infinite;
}
