html:has(body.project-page),
body.project-page {
    overscroll-behavior-y: none;
    padding-bottom: 0;
}

body.project-page footer {
    position: static;
    padding: 6rem 8rem 1.5rem;
    justify-content: flex-end;
}

body.project-page main {
    margin-top: 0;
    padding: 12.1rem 8rem 0 8rem;
    max-width: 120rem;
    margin-left: auto;
    margin-right: auto;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 3rem;
    text-decoration: none;
    color: #999;
    font-size: 1.4rem;
    transition: opacity 0.3s;
}

.back-link:hover {
    opacity: 0.5;
}

.project-detail-left h1 {
    font-size: 3.6rem;
    margin-bottom: 0;
}

.project-subtitle {
    display: block;
}

.project-detail-left .meta {
    font-size: 1.4rem;
    color: #666;
    margin-bottom: 2rem;
}

.project-detail-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: start;
}

.project-detail-left {
    position: fixed;
    top: 8.1rem;
    left: calc((100vw - 120rem) / 2 + 8rem);
    width: calc((120rem - 16rem - 4rem) / 2);
    max-height: calc(100vh - 8.1rem);
    padding-top: 4rem;
    padding-bottom: 4rem;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.project-detail-left::-webkit-scrollbar {
    display: none;
}

@media (max-width: 1360px) {
    .project-detail-left {
        left: 8rem;
        width: calc((100vw - 16rem - 4rem) / 2);
    }
}

.description {
    font-size: 1.8rem;
    line-height: 1.8;
    text-align: justify;
}

.description p {
    margin-bottom: 1.8rem;
}

.description p:last-child {
    margin-bottom: 0;
}

.project-images {
    grid-column: 2;
    padding-top: 0.6rem;
}

.project-images img,
.project-images video {
    width: 100%;
    height: auto;
    display: block;
    margin-bottom: 1rem;
    background-color: #f0f0f0;
}

.project-images img:last-child,
.project-images video:last-child {
    margin-bottom: 0;
}

.project-images img {
    opacity: 0;
    transition: opacity 0.4s ease;
}

.project-images img.loaded {
    opacity: 1;
}

.project-nav-arrow {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    color: #000;
    opacity: 0.18;
    text-decoration: none;
    padding: 1.5rem;
    transition: opacity 0.2s;
    user-select: none;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
}

.project-nav-arrow::before {
    content: '';
    display: block;
    width: 2rem;
    height: 2rem;
    border-top: 1.5px solid currentColor;
    border-right: 1.5px solid currentColor;
    flex-shrink: 0;
}

.project-nav-arrow--prev { left: 8rem; }
.project-nav-arrow--prev::before { transform: rotate(-135deg) translateX(-0.2rem); }

.project-nav-arrow--next { right: 8rem; }
.project-nav-arrow--next::before { transform: rotate(45deg) translateX(-0.2rem); }

a.project-nav-arrow:hover { opacity: 0.7; }

.project-nav-arrow.disabled {
    display: none;
}

@media (max-width: 768px) {
    .project-nav-arrow { display: none; }
}

body.project-page.text-only main {
    max-width: 80rem;
}

body.project-page.text-only h1 {
    font-size: 3.6rem;
    margin-bottom: 2rem;
}

body.project-page.text-only .meta {
    font-size: 1.4rem;
    color: #666;
    margin-bottom: 3rem;
}

body.project-page.text-only .description {
    font-size: 1.8rem;
    line-height: 1.8;
    text-align: justify;
}

@media (max-width: 768px) {
    body.project-page main {
        padding: 10rem 3.5rem 4rem;
    }

    .project-detail-body {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .project-detail-left {
        position: static;
        width: auto;
        max-height: none;
        display: contents;
    }

    .back-link { order: 1; margin-top: 0.5rem; margin-bottom: 0; align-self: flex-end; }

    .project-detail-left h1,
    body.project-page.text-only h1 {
        font-size: 2.8rem;
        margin-bottom: 0;
        order: 2;
    }

    .project-detail-left .meta,
    body.project-page.text-only .meta {
        margin-bottom: 0;
        order: 3;
    }

    .audio-player {
        order: 4;
        margin-top: 0;
        padding-top: 0;
        width: 100%;
    }

    body.project-page .audio-player {
        margin-top: 1.5rem;
    }

    body.project-page .project-detail-left h1 {
        margin-bottom: -0.5rem;
    }

    .project-images {
        grid-column: auto;
        padding-top: 0;
        order: 5;
    }

    .description {
        text-align: left;
        font-size: 1.5rem;
        line-height: 1.6;
        margin-top: 1rem;
        order: 6;
    }

    .description p {
        margin-bottom: 1rem;
    }

    body.project-page.text-only .description {
        text-align: left;
        font-size: 1.5rem;
    }
}
