/* ==========================================================================
   PROJECTS PAGE: SPLIT-SCREEN 3D COVER FLOW
   ========================================================================== */

body.fixed-app {
    overflow: hidden; 
    height: 100vh;
    width: 100%;
    margin: 0;
    padding: 0;
}

.app-layout {
    display: flex;
    width: 100%;
    max-width: 100%;
    height: 100vh;
    padding-top: 100px; 
    overflow: hidden;
}

.index-wrapper {
    width: 40%;
    height: 100%;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255,255,255,0.05);
}

.portfolio-title {
    text-align: center;
    font-size: clamp(2.5rem, 4vw, 4.5rem);
    line-height: 1;
    white-space: nowrap;
    margin: 0;
    padding: 4vh 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.portfolio-title span { color: var(--c-cyan); }

.index-panel {
    flex: 1;
    position: relative; 
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none; 
}
.index-panel::-webkit-scrollbar { display: none; }

.accordion-list { 
    list-style: none; 
    display: flex; 
    flex-direction: column; 
    padding: 40vh 4vw 40vh 5vw; 
    margin: 0;
    width: 100%;
}

.accordion-item { border-bottom: 1px solid rgba(255,255,255,0.08); cursor: pointer; padding: 25px 0; width: 100%; }
.accordion-item:first-child { border-top: 1px solid rgba(255,255,255,0.08); }

.accordion-header { display: flex; align-items: center; gap: 20px; transition: transform 0.6s var(--ease-liquid); }
.p-num { font-family: monospace; font-size: 1.2rem; color: rgba(255,255,255,0.4); transition: color 0.4s; pointer-events: none;}
.p-title { font-size: clamp(1.5rem, 2.2vw, 2.5rem); font-weight: 400; color: rgba(255,255,255,0.6); transition: color 0.4s; pointer-events: none;}

.accordion-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.8s var(--ease-liquid); width: 100%; }
.accordion-content { overflow: hidden; padding-left: 55px; opacity: 0; transform: translateY(20px); transition: opacity 0.5s ease, transform 0.5s ease; width: 100%; }

.p-desc { font-size: 1rem; line-height: 1.7; color: rgba(255,255,255,0.7); margin: 20px 0; word-break: break-word; }
.p-meta { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 10px; width: 100%; }
.p-meta li { font-size: 0.9rem; display: flex; flex-direction: column; color: var(--white); border-left: 1px solid rgba(255,255,255,0.2); padding-left: 15px; word-break: break-word; }
.p-meta li span { color: var(--c-cyan); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; font-weight: bold;}

.accordion-item:hover .p-title { color: var(--white); }
.accordion-item.is-active .accordion-header { transform: translateX(15px); }
.accordion-item.is-active .p-num { color: var(--c-cyan); font-weight: bold; }
.accordion-item.is-active .p-title { color: var(--white); font-weight: 700; }
.accordion-item.is-active .accordion-body { grid-template-rows: 1fr; }
.accordion-item.is-active .accordion-content { opacity: 1; transform: translateY(0); transition-delay: 0.3s; }

.mobile-tiny-carousel { display: none; }
.lightbox-overlay { display: none; }

.contact-cta-wrapper {
    padding: 60px 0 0 0;
    display: flex;
    justify-content: flex-start;
    border-top: 1px solid rgba(255,255,255,0.08); 
    width: 100%;
}

.projects-contact-btn {
    display: inline-flex; align-items: center; gap: 15px;
    padding: 18px 40px; background: rgba(118,207,223,0.1); 
    border: 1px solid rgba(118,207,223,0.3); color: var(--white);
    text-transform: uppercase; font-weight: bold; letter-spacing: 2px;
    border-radius: 50px; text-decoration: none; position: relative; overflow: hidden;
    transition: all 0.4s var(--ease-liquid);
}
.projects-contact-btn:hover {
    background: rgba(118,207,223,0.2); border-color: var(--c-cyan);
    transform: translateY(-3px); box-shadow: 0 10px 20px rgba(0,0,0,0.5);
}
.projects-contact-btn .animated-arrow { width: 20px; height: 20px; color: var(--c-cyan); animation: arrowPulse 2s infinite ease-in-out; }
.projects-contact-btn .btn-shimmer { position: absolute; top: 0; left: -100%; width: 50%; height: 100%; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent); transform: skewX(-20deg); animation: btnShimmer 4s infinite; z-index: 1; pointer-events: none; }

.visual-panel {
    width: 60%;
    height: 100%;
    position: relative;
    background: radial-gradient(circle at center, rgba(118,207,223,0.1) 0%, transparent 70%);
}

.scroll-hint { position: absolute; top: 30px; right: 40px; z-index: 100; display: flex; align-items: center; gap: 10px; opacity: 0.5; }
.mouse-icon { width: 20px; height: 30px; border: 2px solid var(--white); border-radius: 15px; position: relative; }
.mouse-icon::before { content: ''; position: absolute; top: 5px; left: 50%; transform: translateX(-50%); width: 4px; height: 6px; background: var(--white); border-radius: 2px; animation: scrollWheel 2s infinite; }
@keyframes scrollWheel { 0% { transform: translate(-50%, 0); opacity: 1; } 100% { transform: translate(-50%, 10px); opacity: 0; } }

.carousel-3d {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    perspective: 1500px;
    opacity: 0; visibility: hidden; pointer-events: none;
    transform: scale(0.85); filter: blur(20px);
    transition: all 1.2s var(--ease-liquid);
}
.carousel-3d.is-active { opacity: 1; visibility: visible; pointer-events: auto; transform: scale(1); filter: blur(0); z-index: 10; }
.carousel-track { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; display: flex; justify-content: center; align-items: center; }

.slide-3d {
    position: absolute; width: 55%; aspect-ratio: 4/3;
    border-radius: 12px; overflow: hidden; box-shadow: 0 40px 80px rgba(0,0,0,0.8);
    transition: all 0.8s cubic-bezier(0.25, 1, 0.5, 1); cursor: pointer;
    opacity: 0; transform: translateX(0) translateZ(-600px) rotateY(0deg);
    z-index: 1; pointer-events: none;
}
.slide-3d img { width: 100%; height: 100%; object-fit: cover; }
.slide-3d::after { content: ''; position: absolute; inset: 0; background: rgba(0,0,0,0.7); transition: opacity 0.8s; }

.slide-3d.active { transform: translateX(0) translateZ(0) rotateY(0deg); z-index: 10; opacity: 1; pointer-events: auto; cursor: default; }
.slide-3d.active::after { opacity: 0; }
.slide-3d.prev { transform: translateX(-40%) translateZ(-250px) rotateY(30deg); z-index: 5; opacity: 0.6; pointer-events: auto; }
.slide-3d.prev:hover { opacity: 0.9; transform: translateX(-45%) translateZ(-200px) rotateY(25deg); }
.slide-3d.next { transform: translateX(40%) translateZ(-250px) rotateY(-30deg); z-index: 5; opacity: 0.6; pointer-events: auto; }
.slide-3d.next:hover { opacity: 0.9; transform: translateX(45%) translateZ(-200px) rotateY(-25deg); }

/* ==========================================================================
   MOBILE ADAPTATION: STRICT NATIVE APP FEEL
   ========================================================================== */
@media (max-width: 1000px) {
    html, body.fixed-app {
        position: fixed !important;
        top: 0; left: 0; right: 0; bottom: 0;
        width: 100%; height: 100% !important;
        overflow: hidden !important;
        overscroll-behavior: none;
    }

    .app-layout {
        flex-direction: column;
        height: 100% !important; width: 100%;
        overflow-y: auto !important; overflow-x: hidden !important;
        padding-top: 80px;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
    }

    /* Override main.css wrapper padding to prevent double-padding */
    .page-projects .index-wrapper { padding: 0 !important; }

    .index-wrapper { width: 100%; height: auto; border-right: none; }
    .index-panel { overflow: visible !important; }

    .portfolio-title { white-space: normal; word-break: break-word; padding: 20px 5vw; font-size: 2.2rem; text-align: left; }

    /* Preserve grid accordion — override main.css display:block */
    .accordion-body { display: grid !important; }

    /* Override main.css ≤900px forced centering — restore left-aligned list */
    body.page-projects .portfolio-title {
        text-align: left !important;
        margin-bottom: 0 !important;
    }
    body.page-projects .accordion-list {
        align-items: stretch !important;
        padding: 5vw !important;
        padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px)) !important;
    }
    body.page-projects .accordion-item {
        max-width: none !important;
        align-items: stretch !important;
        text-align: left !important;
        margin: 0 !important;
    }
    body.page-projects .accordion-header {
        justify-content: flex-start !important;
    }
    /* Disable desktop translateX shift on mobile */
    .accordion-item.is-active .accordion-header { transform: none !important; }
    body.page-projects .accordion-content {
        align-items: flex-start !important;
    }
    body.page-projects .contact-cta-wrapper {
        padding: 40px 0 0 0 !important;
        margin: 0 !important;
        max-width: none !important;
        align-items: stretch !important;
    }

    .accordion-list { width: 100%; max-width: 100%; }
    .accordion-content { padding-left: 0; padding-top: 15px; }

    .projects-contact-btn { width: 100%; justify-content: center; font-size: 0.95rem; padding: 18px 20px; }

    .visual-panel { display: none !important; }

    .mobile-tiny-carousel {
        display: block;
        width: 100%;
        height: 140px;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        position: relative;
        border-radius: 8px;
        margin-bottom: 20px;
        cursor: pointer;
        background: #000;
        border: 1px solid rgba(255,255,255,0.05);
        scrollbar-width: none;
    }
    .mobile-tiny-carousel::-webkit-scrollbar { display: none; }

    .tiny-track { display: flex; height: 100%; width: max-content; gap: 10px; padding-right: 10px; }
    .tiny-track img { height: 100%; width: 180px; object-fit: cover; border-radius: 4px; pointer-events: none; }

    /* Override main.css carousel overrides — restore compact auto-scroll strip */
    body.page-projects .mobile-tiny-carousel {
        margin: 0 0 20px 0 !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        scroll-snap-type: none !important;
    }
    body.page-projects .tiny-track {
        gap: 10px !important;
        height: 100% !important;
    }
    body.page-projects .tiny-track img {
        height: 100% !important;
        width: 180px !important;
        max-width: none !important;
        scroll-snap-align: unset !important;
    }
    
    .tap-hint { 
        position: sticky; left: calc(100% - 130px); margin-left: -130px; margin-top: 105px; 
        width: max-content; font-size: 0.7rem; background: rgba(3,6,12,0.8); 
        padding: 4px 10px; border-radius: 20px; color: var(--c-cyan); 
        border: 1px solid var(--c-cyan); text-transform: uppercase; 
        letter-spacing: 1px; z-index: 10; pointer-events: none;
    }

    .lightbox-overlay { 
        position: fixed; inset: 0; z-index: 9999; 
        background: rgba(3,5,9,0.98); backdrop-filter: blur(10px); 
        display: flex; flex-direction: column; justify-content: center; align-items: center; 
        opacity: 0; visibility: hidden; pointer-events: none;
        transition: opacity 0.3s; touch-action: none; width: 100%; height: 100%;
    }
    .lightbox-overlay.active { opacity: 1; visibility: visible; pointer-events: auto; }
    
    .lightbox-close { position: absolute; top: 20px; right: 20px; color: var(--white); font-size: 2.5rem; cursor: pointer; z-index: 10; line-height: 1; padding: 10px; }
    
    .lightbox-scroll-area { 
        display: flex; overflow-x: auto; scroll-snap-type: x mandatory; 
        overscroll-behavior-x: contain; width: 100%; height: 60vh; padding: 0; gap: 15px;
        scrollbar-width: none; -webkit-overflow-scrolling: touch;
    }
    .lightbox-scroll-area::-webkit-scrollbar { display: none; }
    
    .lb-img { scroll-snap-align: center; height: 100%; width: 90vw; padding: 0 5vw; object-fit: contain; flex-shrink: 0; border-radius: 8px; }

    .lightbox-hint { position: absolute; bottom: 30px; color: var(--c-cyan); font-family: monospace; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 2px; opacity: 0.7; pointer-events: none; }
}