/**
 * Project Detail Page - Minimalist Redesign
 * Matches a21studio style
 * Font: Inter (Vietnamese support) + IBM Plex Mono (Title)
 */

/* ============================================
   BASE STYLES & THEME
   ============================================ */

/* ============================================
   BASE STYLES & THEME
   ============================================ */

.project-page {
    background: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-body);
    overflow-x: hidden;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    transition: background 0.3s ease, color 0.3s ease;
}

/* Scroll Progress */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    background: var(--text-color);
    width: 0;
    z-index: 2000;
    transition: width 0.1s linear;
}

/* ============================================
   HEADER
   ============================================ */

/* Removed local header overrides as they are now handled by base.css */

/* Nav Link Style */
/* Removed local nav overrides */

/* Logo Style - Inherits from base.css */
.logo {
    opacity: 0.9;
    transition: opacity 0.3s ease;
}

.logo:hover {
    opacity: 1;
}

/* Back Button */
.back-button {
    position: fixed;
    top: 20px;
    left: 30px;
    z-index: 1100;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--back-color);
    font-size: 0.8rem;
    font-weight: 500;
    transition: color 0.3s ease;
}

.back-button svg {
    width: 18px;
    height: 18px;
}

.back-button:hover {
    color: var(--back-hover);
}

/* ============================================
   MAIN CONTENT LAYOUT (Compact)
   ============================================ */

.main-content {
    padding-top: 126px; /* Gap of 60px from logo bottom */
    padding-bottom: 80px;
    max-width: 1920px;
    margin: 0 auto;
}

/* ============================================
   PROJECT HEADER (Title + Meta)
   ============================================ */

.project-header {
    padding: 0 20px 5px; /* Reduced from 20px padding-bottom */
    max-width: 1160px;
    margin: 0 auto;
}

.project-title {
    font-family: var(--font-display);
    font-size: clamp(1.2rem, 2.2vw, 1.8rem); /* Reduced from clamp(1.8rem, 3vw, 2.5rem) */
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1.4; /* Increased from 1.2 to prevent accent clipping */
    margin: 0 0 10px 0; /* Reduced from 15px */
    color: var(--text-color);
    text-transform: uppercase;
}

.project-description {
    max-width: 800px; /* Increased from 700px to allow more space */
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--desc-color);
}

.project-info {
    padding: 20px 20px 0;
    display: grid;
    grid-template-columns: 1fr 320px; /* Fixed width for meta to force wrapping and allow description to be wider */
    gap: 60px;
    align-items: flex-start;
    max-width: 1160px;
    margin: 0 auto;
}

.project-meta {
    display: flex;
    flex-direction: column;
    gap: 25px;
    text-align: left;
    min-width: 250px;
    justify-self: end;
}

.meta-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.meta-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--meta-label);
    font-weight: 600;
}

.meta-value {
    font-size: 0.9rem;
    color: var(--meta-value);
    font-weight: 400;
}

.meta-value--multiline {
    white-space: normal;
    /* Changed from pre-line for easier flow */
    line-height: 1.5;
}

/* ============================================
   GALLERY GRID (4 Columns)
   ============================================ */

.project-gallery {
    padding: 0 20px;
    max-width: 1160px;
    margin: 20px auto 0; /* Reduced from 40px */
}

.project-video {
    width: 100%;
    max-width: 1194px; /* iPad 11-inch landscape width */
    margin: 40px auto 80px;
    aspect-ratio: 16 / 9;
    background: #000;
    box-shadow: 0 40px 100px rgba(0,0,0,0.8);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    z-index: 5;
    transition: all 0.5s ease;
}

/* Video Mode (Only Video) */
.video-mode .project-header,
.video-mode .project-gallery,
.video-mode .project-info,
.video-mode .scroll-progress {
    display: none !important;
}

.video-mode .main-content {
    padding-top: 0;
    padding-bottom: 0;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.video-mode .project-video {
    margin: 0;
    max-width: 100%;
    width: 95vw;
    height: auto;
    aspect-ratio: 16 / 9;
    box-shadow: 0 0 150px rgba(0,0,0,1);
    border-radius: 0;
}

/* Adjust iPad specific landscape viewport */
@media (orientation: landscape) and (max-height: 1024px) {
    .video-mode .project-video {
        width: auto;
        height: 85vh; /* Fills most of the height while maintaining ratio */
    }
}

.video-mode .back-button {
    background: rgba(255, 255, 255, 0.1);
    padding: 12px 24px;
    border-radius: 40px;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
}

.video-mode .back-button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.project-video video {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.gallery-grid {
    column-count: 4;

    column-gap: 40px;
    width: 100%;
}

.gallery-item {
    position: relative;
    width: 100%;
    margin-bottom: 40px;
    break-inside: avoid;
    overflow: hidden;
    background: transparent;
    cursor: zoom-in;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

/* Dark mode background for gallery items removed */

.gallery-item.is-inview {
    opacity: 1;
    transform: translateY(0);
}

.gallery-image {
    width: 100%;
    height: auto;
    object-fit: contain;
    transition: transform 0.5s cubic-bezier(0.2, 1, 0.3, 1);
    display: block;
}

.gallery-item:hover .gallery-image {
    transform: scale(1.03);
}

/* ============================================
   RESPONSIVE
   ============================================ */

/* ============================================
   RESPONSIVE
   ============================================ */

/* Small Laptops & iPads Portrait */
@media (max-width: 1024px) {
    .project-header {
        padding: 0 30px 20px;
    }

    .project-info {
        padding: 30px 30px 0;
        gap: 40px;
    }

    .main-content {
        padding-top: 140px; /* Increased from 116px for header clearance on tablets */
    }
}

/* Phones and narrow tablets: stack the introduction above the project metadata. */
@media (max-width: 768px) {
    .project-description {
        font-size: 0.9rem;
        width: 100%;
    }

    .project-info {
        grid-template-columns: minmax(0, 1fr);
        gap: 28px;
        padding: 24px 20px 0;
    }

    .project-meta {
        width: 100%;
        min-width: 0;
        justify-self: stretch;
        gap: 15px;
    }

    .gallery-grid {
        column-count: 2;
        column-gap: 20px;
    }
}

/* Mobile Devices */
@media (max-width: 480px) {
    .main-content {
        padding-top: 160px; /* Increased from 100px to prevent header overlap on mobile */
    }

    .project-title {
        font-size: 1.4rem;
        margin-bottom: 5px;
    }

    .meta-group {
        min-width: 120px;
    }

    .gallery-grid {
        column-count: 1;
    }

    .project-header {
        padding-bottom: 10px;
    }

    .project-gallery {
        margin-top: 15px;
    }

    .back-button span {
        display: none;
        /* Hide 'Back' text on very small screens, keep icon */
    }
}

/* ============================================
   LIGHTBOX 
   ============================================ */

.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.98);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(5px);
}

.lightbox-overlay.is-open {
    display: flex;
    animation: fadeIn 0.3s ease-out;
}

.lightbox-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.lightbox-image {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 20px;
    font-size: 2rem;
    color: #000000;
    opacity: 0.6;
    transition: opacity 0.2s;
    z-index: 20;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
    opacity: 1;
}

.lightbox-close {
    top: 20px;
    right: 20px;
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.project-lead p {
    margin: 0 0 10px;
}

.project-lead p:last-child {
    margin-bottom: 0;
}
