/* ==========================================================
   Mobile Reel View - 3D Book-Curl Swipe & Slide-Up Drawer
   ========================================================== */

.mobile-reel-viewport {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    height: 100vh;
    background: #030712;
    overflow: hidden;
    perspective: 1400px;
    -webkit-perspective: 1400px;
    user-select: none;
    -webkit-user-select: none;
    touch-action: pan-y;
}

.reel-card-deck {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
}

/* Base Card Style */
.reel-card {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    overflow: hidden;
    transition: transform 0.55s cubic-bezier(0.2, 0.8, 0.2, 1), 
                opacity 0.55s cubic-bezier(0.2, 0.8, 0.2, 1), 
                box-shadow 0.55s ease;
    will-change: transform, opacity;
}

/* Card States for 3D Book-Curl Turning */
.reel-card.active {
    transform: translateY(0%) rotateX(0deg) scale(1);
    opacity: 1;
    z-index: 10;
    pointer-events: auto;
}

/* Card Flipping Upwards (Previous Page in Curl) */
.reel-card.curl-up {
    transform-origin: top center;
    transform: translateY(-105%) rotateX(65deg) scale(0.92);
    opacity: 0;
    z-index: 15;
    pointer-events: none;
    box-shadow: 0 40px 60px rgba(0, 0, 0, 0.85);
}

/* Card Waiting Below (Next Page Curling In) */
.reel-card.curl-down {
    transform-origin: bottom center;
    transform: translateY(105%) rotateX(-65deg) scale(0.92);
    opacity: 0;
    z-index: 5;
    pointer-events: none;
}

/* Page-Curl Paper Shadow & Sheen Layer */
.book-curl-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    background: linear-gradient(
        180deg, 
        rgba(0, 0, 0, 0.15) 0%, 
        transparent 35%, 
        transparent 65%, 
        rgba(0, 0, 0, 0.45) 85%,
        rgba(0, 0, 0, 0.95) 100%
    );
}

.book-curl-spine-shadow {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.6) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 20;
}

.is-turning .book-curl-spine-shadow {
    opacity: 1;
}

/* Card Hero Media */
.reel-card-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

/* Card Floating Content Overlay */
.reel-card-content {
    position: relative;
    z-index: 5;
    padding: 1.5rem 1.25rem 2.25rem 1.25rem;
    color: #ffffff;
}

/* Floating publisher logo pill */
.publisher-pill {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Slide-Up Drawer for Full Article */
.drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 9990;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.drawer-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.slide-up-drawer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 88vh;
    background: #0f172a;
    color: #f8fafc;
    border-top-left-radius: 1.75rem;
    border-top-right-radius: 1.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 -20px 40px rgba(0, 0, 0, 0.5);
    z-index: 9999;
    transform: translateY(102%);
    transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.slide-up-drawer.open {
    transform: translateY(0%);
}

.drawer-handle {
    width: 44px;
    height: 5px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 9999px;
    margin: 0.75rem auto 0.5rem auto;
    cursor: pointer;
}

.drawer-scroll-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem 1.5rem 3rem 1.5rem;
    -webkit-overflow-scrolling: touch;
}

/* Native Feed Ad Cards */
.ad-card-badge {
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: white;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.35);
}

/* Video ad player overlay */
.video-ad-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.video-ad-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Up/Down Reel Swipe Nav Floating Helpers */
.reel-nav-pill {
    position: fixed;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 80;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.reel-nav-btn {
    width: 40px;
    height: 40px;
    border-radius: 9999px;
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.reel-nav-btn:hover {
    background: rgba(79, 70, 229, 0.8);
    transform: scale(1.1);
}

/* Pulse animation for Read More button */
@keyframes pulseSubtle {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

.read-more-pulse {
    animation: pulseSubtle 2.2s infinite ease-in-out;
}
