/* --- PREMIUM PROJECT DETAIL PAGES --- */

body::before {
    content: '';
    position: fixed;
    top: -10%;
    left: -10%;
    width: 50vw;
    height: 50vh;
    background: radial-gradient(circle, rgba(255, 46, 84, 0.4) 0%, transparent 70%);
    filter: blur(100px);
    z-index: -1;
    pointer-events: none;
    opacity: 0.5;
}

.container.column-layout, 
.nav-dock {
    background: rgba(20, 20, 20, 0.65) !important;
    backdrop-filter: blur(24px) !important;
    -webkit-backdrop-filter: blur(24px) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5) !important;
}

/* 3. BUTTON OVERLAP FIX */
.btn-outline {
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    background: transparent;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: normal; /* Fixes text overflowing buttons */
    height: auto;
    text-align: center;
    max-width: 100%;
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.05);
}

/* --- HEADER & LAYOUT --- */
.project-detail-header {
    display: flex !important; 
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 2rem;
    animation: fadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    width: 100%;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
    min-width: 0; /* Prevents flexbox horizontal scroll */
}

.back-arrow {
    color: #9ca3af;
    font-size: 1.8rem;
    text-decoration: none;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.05);
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.back-arrow:hover {
    color: #ff2e54;
    border-color: #ff2e54;
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(255, 46, 84, 0.2);
}

.header-title {
    min-width: 0; /* Allows text to wrap properly */
}

.header-title h1 {
    font-size: 2.5rem;
    margin: 0;
    font-weight: 800;
    letter-spacing: -1px;
    color: #fff;
    overflow-wrap: break-word;
}

.header-title p {
    color: #9ca3af;
    margin: 8px 0 0 0;
    font-size: 1.05rem;
    font-weight: 300;
}

.header-nav {
    display: flex;
    gap: 15px;
    flex-wrap: wrap; /* Prevents buttons from clipping out of screen */
}

/* Main Content Typography */
main > h2 {
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #9ca3af;
    margin-bottom: 1.5rem;
    animation: fadeUp 0.8s ease-out 0.2s forwards;
    opacity: 0;
    font-weight: 800;
}

.demo-video-container {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    overflow: hidden; 
    /* line-height: 0; <-- Remove this, it can cause weird collapsing issues */
    animation: fadeUp 0.8s ease-out 0.3s forwards;
    opacity: 0;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    background: rgba(10, 10, 10, 0.6);
    
    /* --- NEW FIX --- */
    width: 100%;
    aspect-ratio: 16 / 9; /* Locks the container to standard widescreen format */
}

.demo-video-container video, .demo-video-container iframe {
    width: 100%;
    height: 100%; /* Forces the iframe to fill the 16:9 container */
    display: block;
    border: none; /* Removes any default iframe borders */
}

/* Content Sections */
.content-grid {
    padding-top: 60px;
    display: grid;
    gap: 60px; 
    width: 100%;
}

.content-block {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 50px;
    align-items: center;
    opacity: 0;
    animation: fadeUp 0.8s ease-out forwards;
    width: 100%;
}

.text-content {
    min-width: 0; /* Let grid shrink content properly */
}

/* A content block with no companion image spans the full width instead of
   leaving a dead column. */
.content-block.text-only {
    grid-template-columns: minmax(0, 1fr);
    max-width: 900px;
}

.text-content h2 {
    font-size: 2rem;
    font-weight: 800;
    margin: 0 0 1.5rem 0;
    color: #fff;
    letter-spacing: -0.5px;
    overflow-wrap: break-word;
}

.text-content p {
    color: #9ca3af;
    line-height: 1.8;
    font-size: 1.05rem;
    margin-bottom: 1.5rem;
    overflow-wrap: break-word;
}

.text-content ul {
    color: #9ca3af;
    line-height: 1.8;
    font-size: 1rem;
    padding-left: 1.2rem;
}

.text-content strong {
    color: #fff;
}

.image-content {
    max-width: 100%;
}

.image-content img,
.image-content video {
    width: 100%;
    border-radius: 16px;
    object-fit: cover;
    height: 100%;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
}

.content-block:nth-of-type(1) { animation-delay: 0.2s; }
.content-block:nth-of-type(2) { animation-delay: 0.3s; }
.content-block:nth-of-type(3) { animation-delay: 0.4s; }

.image-content .ui-clip { width: 100%; height: auto; border-radius: 16px; object-fit: contain; }
.image-content .media-row { display: flex; gap: 20px; width: 100%; justify-content: center; align-items: center; margin-top: 1.5rem; flex-wrap: wrap; }
.image-content .media-column { display: flex; flex-direction: column; gap: 20px; width: 100%; justify-content: center; align-items: center; }
.image-content .ui-standard { width: 100%; max-width: 450px; height: auto; }
.image-content .ui-square { width: 45%; max-width: 250px; aspect-ratio: 1 / 1; object-fit: cover; }

@media (max-width: 900px) {
    .project-detail-header {
        flex-direction: column !important;
        gap: 25px;
        align-items: flex-start;
    }
    .header-left {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        width: 100%;
    }
    .back-arrow {
        position: absolute;
        top: 2rem;
        right: 2rem;
    }
    /* Keep header text clear of the floating back arrow */
    .header-title { padding-right: 70px; }
    .header-nav {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }
    .content-block { grid-template-columns: minmax(0, 1fr); }
    .content-block:nth-of-type(even) .image-content { order: -1; }
    
    .text-content h2 { font-size: 1.6rem; }
    .header-title h1 { font-size: 2rem; }
    
    .btn-outline {
        width: 100%;
        text-align: center;
        padding: 1rem;
    }
}