/* Project Page Specific Styles */

.main-content {
    padding-top: 119px;
}

/* About and Contact Page Styles */
body:has(.about-content) .main-content,
body:has(.contact-info) .main-content {
    margin-top: 30px;
}

/* About Page Styles */
.about-content {
    display: flex;
    flex-direction: column;
    max-width: 1000px;
    gap: 40px;
}

.about-photo {
    width: 100%;
    max-width: 200px;
}

.about-photo img {
    width: 100%;
    height: auto;
    display: block;
    margin-bottom: 10px;
}

.photo-credit {
    font-size: 11px;
    color: #888888;
    font-style: italic;
    margin: 0;
}

.about-text {
    flex: 1;
}

.about-text .project-description {
    max-width: 800px;
}

@media (min-width: 768px) {
    .about-content {
        flex-direction: row;
        align-items: flex-start;
    }

    .about-photo {
        flex-shrink: 0;
    }
}

.project-header {
    margin-bottom: 40px;
}

.project-category {
    font-size: 19px;
    font-weight: normal;
    letter-spacing: 0.5px;
    color: #888888a8;
    text-transform: uppercase;
}

.project-details {
    margin-bottom: 50px;
    max-width: 1400px;
}

.project-title {
    font-size: 19px;
    font-weight: bold;
    margin-bottom: 20px;
}

.project-description {
    font-size: 15px;
    line-height: 1.8;
    color: #444444d1;
    max-width: 1400px;
    margin-bottom: 60px;
}

.project-images {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    max-width: 1000px;
}

.image-placeholder {
    width: 100%;
    aspect-ratio: 16/9;
    background-color: #2b2b2b;
}

/* Bin Packing Layout for Optimal Image Display */
.bin-packed-layout {
    width: 100%;
    max-width: 1000px;
}

.bin-packed-row {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    width: 100%;
}

.bin-packed-row img {
    display: block;
}

.bin-packed-row img:last-child {
    margin-right: 0 !important;
}

/* Gallery Image Hover Overlay */
.gallery-image-wrapper {
    position: relative;
    display: inline-block;
    overflow: hidden;
}

.gallery-image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 20px;
}

.gallery-image-wrapper:hover .gallery-image-overlay {
    opacity: 1;
}

.gallery-image-description {
    color: white;
    font-size: 15px;
    text-align: center;
    line-height: 1.6;
}

/* Video Play Button Overlay - Only for non-animation videos */
.gallery-image-wrapper:not(.animation-video):has(video)::before {
    content: '▶';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #000;
    opacity: 0.8;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1;
    padding-left: 4px;
}

.gallery-image-wrapper:not(.animation-video):has(video):hover::before {
    opacity: 0;
}

/* Hide overlay for animation videos */
.gallery-image-wrapper.animation-video .gallery-image-overlay {
    display: none;
}

/* Sound Toggle Button for Animation Videos */
.sound-toggle-btn {
    position: absolute;
    bottom: 15px;
    right: 15px;
    width: 31px;
    height: 31px;
    background: transparent;
    border: 1.5px solid #000000;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
    padding: 0;
}

.sound-toggle-btn:hover {
    background: rgba(0, 0, 0, 0.6);
    border-color: transparent;
}

.sound-toggle-btn svg {
    width: 16px;
    height: 16px;
    color: #000000;
    transition: color 0.2s ease;
}

.sound-toggle-btn:hover svg {
    color: #ffffff;
}

/* Inverted button for dark videos */
.sound-toggle-btn.inverted {
    border-color: #ffffff;
}

.sound-toggle-btn.inverted svg {
    color: #ffffff;
}

.sound-toggle-btn.inverted:hover {
    background: rgba(255, 255, 255, 0.6);
    border-color: transparent;
}

.sound-toggle-btn.inverted:hover svg {
    color: #000000;
}

/* Hide the X lines when unmuted, show sound waves */
.sound-toggle-btn[data-muted="false"] .sound-off-indicator {
    display: none;
}

.sound-toggle-btn[data-muted="false"] .sound-on-indicator {
    display: block;
}

/* Hide sound waves when muted, show X */
.sound-toggle-btn[data-muted="true"] .sound-on-indicator {
    display: none;
}

.sound-toggle-btn[data-muted="true"] .sound-off-indicator {
    display: block;
}

/* Gallery Section Styling */
.gallery-section {
    margin-bottom: 80px;
}

/* Hidden Row and See More Button */
.hidden-row {
    display: none;
}

.see-more-container {
    display: flex;
    justify-content: center;
    margin-top: 40px;
    margin-bottom: 20px;
}

.see-more-btn {
    background-color: #000000;
    color: #ffffff;
    border: none;
    padding: 12px 40px;
    font-size: 14px;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: opacity 0.2s;
    font-weight: normal;
}

.see-more-btn:hover {
    opacity: 0.8;
}

/* Mosaic Layout for Illustration Project */
.image-block {
    width: 100%;
    margin-bottom: 40px;
}

.mosaic-layout {
    display: grid;
    gap: 10px;
    width: 100%;
}

/* First block - comic-general mosaic (5 images) - solid rectangle contact sheet */
.mosaic-general {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 300px);
    gap: 0;
    width: 100%;
}

.mosaic-general img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    margin: 0;
    padding: 0;
}

/* Layout matching example-grid.png:
   Left column: large image + character sketches
   Middle column: 2 stacked images
   Right column: tall vertical comic */
.mosaic-general img:nth-child(1) {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
}

.mosaic-general img:nth-child(2) {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
}

.mosaic-general img:nth-child(3) {
    grid-column: 2 / 3;
    grid-row: 2 / 3;
}

.mosaic-general img:nth-child(4) {
    grid-column: 3 / 4;
    grid-row: 1 / 3;
}

.mosaic-general img:nth-child(5) {
    grid-column: 1 / 2;
    grid-row: 2 / 3;
}

@media (max-width: 1200px) {
    .mosaic-general {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(3, 250px);
        gap: 0;
    }

    .mosaic-general img:nth-child(1),
    .mosaic-general img:nth-child(2),
    .mosaic-general img:nth-child(3),
    .mosaic-general img:nth-child(4),
    .mosaic-general img:nth-child(5) {
        grid-column: auto;
        grid-row: auto;
    }
}

@media (max-width: 768px) {
    /* Hide desktop sidebar on mobile */
    .sidebar {
        display: none !important;
    }

    /* Main content full width with proper spacing */
    .main-content {
        margin-left: 0 !important;
        margin-top: 140px !important;
        padding: 20px !important;
        width: 100% !important;
    }

    /* Hide category title on mobile */
    .project-category {
        display: none !important;
    }

    .project-header {
        margin-bottom: 0 !important;
    }

    /* Gallery sections */
    .gallery-section {
        margin-bottom: 50px;
    }

    /* Section titles */
    .project-title {
        font-size: 16px;
        margin-bottom: 8px;
        text-align: left;
    }

    /* Section descriptions */
    .project-description {
        font-size: 13px;
        margin-bottom: 15px;
        line-height: 1.5;
    }

    /* Single column layout for images */
    .bin-packed-layout {
        display: flex;
        flex-direction: column;
        gap: 0;
    }

    .bin-packed-row {
        display: flex;
        flex-direction: column;
        gap: 0;
        margin-bottom: 0 !important;
    }

    .bin-packed-row:not(:last-child) {
        margin-bottom: 15px !important;
    }

    .gallery-image-wrapper {
        width: 100% !important;
        height: auto !important;
        margin-right: 0 !important;
        margin-bottom: 15px !important;
    }

    /* On mobile, don't remove margin from last-child since rows are restructured */
    /* The last visible image needs consistent spacing before the button */
    .gallery-image-wrapper:last-child {
        margin-bottom: 15px !important;
    }

    .gallery-image-wrapper img,
    .gallery-image-wrapper video {
        width: 100% !important;
        height: auto !important;
        max-height: 70vh;
        object-fit: contain !important;
    }

    /* Hide desktop see-more buttons initially on mobile */
    .see-more-container {
        display: none !important;
    }

    /* Force hide images with mobile-hidden class */
    .gallery-image-wrapper.mobile-hidden {
        display: none !important;
    }

    .gallery-image-wrapper.mobile-visible {
        display: block !important;
    }

    /* Mobile see-more button styling (created by JS) */
    .mobile-see-more-container {
        margin-top: 0 !important;
        margin-bottom: 30px !important;
        display: flex;
        justify-content: center;
    }

    .mobile-see-more-btn {
        background-color: #000000;
        color: #ffffff;
        border: none;
        padding: 10px 30px !important;
        font-size: 13px !important;
        height: 38px;
        cursor: pointer;
        transition: opacity 0.2s;
        font-weight: normal;
        letter-spacing: 0.5px;
    }

    .mobile-see-more-btn:active {
        opacity: 0.8;
    }

    /* Image overlay on mobile */
    .gallery-image-overlay {
        opacity: 0;
        transition: opacity 0.3s;
    }

    .gallery-image-wrapper:active .gallery-image-overlay {
        opacity: 1;
    }

    /* Prevent overlay from showing during scroll animation */
    .gallery-image-wrapper.no-overlay-temp .gallery-image-overlay,
    .gallery-image-wrapper.no-overlay-temp:active .gallery-image-overlay {
        opacity: 0 !important;
    }

    .project-images {
        grid-template-columns: 1fr;
    }

    .mosaic-general {
        grid-template-columns: 1fr;
        grid-template-rows: repeat(5, 200px);
        gap: 0;
    }

    .mosaic-general img {
        grid-column: 1 !important;
        grid-row: auto !important;
    }

    /* Hide sound toggle button on mobile for animation videos */
    .sound-toggle-btn {
        display: none !important;
    }

    /* Mobile Play Button for Animation Videos */
    .mobile-play-btn {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 36px;
        height: 36px;
        background: rgba(255, 255, 255, 0.675);
        border: 1px solid #000000;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        z-index: 10;
        transition: all 0.2s ease;
        padding: 0;
    }

    .mobile-play-btn svg {
        width: 18px;
        height: 18px;
        color: #000000;
        margin-left: 2px;
    }

    .mobile-play-btn.playing {
        background: rgba(0, 0, 0, 0.9);
        border: 1px solid #000000;
    }

    .mobile-play-btn.playing svg {
        color: #ffffff;
        margin-left: 0;
    }

    /* Inverted play button for dark videos */
    .mobile-play-btn.inverted {
        background: rgba(0, 0, 0, 0.9);
        border: 1px solid #ffffff;
    }

    .mobile-play-btn.inverted svg {
        color: #ffffff;
    }

    .mobile-play-btn.inverted.playing {
        background: rgba(255, 255, 255, 0.675);
        border: 1px solid #ffffff;
    }

    .mobile-play-btn.inverted.playing svg {
        color: #000000;
    }
}

/* Lightbox Styles */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.lightbox.active {
    display: flex;
}

.lightbox-content {
    position: relative;
    max-width: 70%;
    max-height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-image-wrapper {
    position: relative;
    max-width: 100%;
    max-height: 90vh;
    overflow: hidden;
}

.lightbox-image-wrapper img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    display: block;
}

.lightbox-description {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 20px;
    font-size: 14px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.lightbox-image-wrapper:hover .lightbox-description {
    transform: translateY(0);
}

.lightbox-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 48px;
    color: #000000;
    cursor: pointer;
    padding: 20px;
    z-index: 10000;
    transition: opacity 0.2s;
    font-weight: 300;
    line-height: 1;
}

.lightbox-arrow:hover {
    opacity: 0.6;
}

.lightbox-arrow.prev {
    left: 40px;
}

.lightbox-arrow.next {
    right: 40px;
}

.lightbox-close {
    position: absolute;
    top: 40px;
    right: 40px;
    background: none;
    border: none;
    font-size: 36px;
    color: #000000;
    cursor: pointer;
    z-index: 10000;
    transition: opacity 0.2s;
    font-weight: 300;
    line-height: 1;
}

.lightbox-close:hover {
    opacity: 0.6;
}

@media (max-width: 768px) {
    .lightbox-arrow {
        font-size: 32px;
        padding: 10px;
    }

    .lightbox-arrow.prev {
        left: 10px;
    }

    .lightbox-arrow.next {
        right: 10px;
    }

    .lightbox-close {
        top: 10px;
        right: 10px;
        font-size: 28px;
    }
}

/* Food section - crop 15% from top and 15% from bottom */
.bin-packed-row[data-section="5-food"] img {
    object-position: center;
    clip-path: inset(15% 0 15% 0);
}
