/* PROJECT PAGE ----------------------------------------------------------- */

/* Hero */
.project-hero {
    position: relative;
    min-height: 78vh;
    min-height: 78svh;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
    isolation: isolate;
}
.project-hero-bg {
    position: absolute;
    inset: 0;
    z-index: -1;
}
.project-hero-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    animation: projectHeroIn 1.4s var(--ease-out) both;
}
@keyframes projectHeroIn {
    from { opacity: 0; transform: scale(1.05); }
}
.project-hero-bg::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(to right, color-mix(in srgb, var(--c-dark) 82%, transparent) 0%, color-mix(in srgb, var(--c-dark) 40%, transparent) 38%, transparent 62%),
        linear-gradient(to top, var(--c-dark) 0%, color-mix(in srgb, var(--c-dark) 55%, transparent) 24%, transparent 52%);
}
.project-hero-content {
    padding-top: calc(var(--header-height) + var(--space-xl));
    padding-bottom: var(--space-lg);
}
.project-back {
    margin-bottom: var(--space-md);
}
.project-hero h1 {
    max-width: 16ch;
    margin-bottom: var(--space-sm);
}
.project-hero-sub {
    font-size: var(--fs-lead);
    color: var(--c-light);
}

/* Overview: facts + summary */
.project-overview {
    display: grid;
    grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
    gap: var(--space-lg);
    padding-top: var(--space-lg);
    padding-bottom: var(--section-pad);
}
.project-meta {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--c-dark-muted);
}
.project-meta dt {
    font-size: var(--fs-label);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: var(--ls-label);
    color: var(--c-txt-muted);
    margin-bottom: var(--space-2xs);
}
.project-meta dd {
    color: var(--c-light);
    font-weight: 500;
}
.project-meta .tag-list {
    font-size: 1rem;
    letter-spacing: 0;
    color: var(--c-light);
}
.project-summary {
    color: var(--c-light);
    font-size: clamp(1.25rem, 2vw, 1.5rem);
    line-height: 1.5;
    padding-top: var(--space-md);
    border-top: 1px solid var(--c-dark-muted);
}

/* Video: a poster link that becomes the player on click (js/project-ui.js) */
.project-video {
    padding-bottom: var(--section-pad);
}
.project-video-wrap {
    display: block;
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-card);
    overflow: hidden;
    border: 1px solid var(--c-dark-muted);
    background-color: var(--c-dark-soft);
}
.project-video--vertical .project-video-wrap {
    aspect-ratio: 9 / 16;
    max-width: 420px;
    margin: 0 auto;
}
.project-video-wrap iframe,
.project-video-wrap img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}
.project-video-wrap img {
    object-fit: cover;
    transition: transform 0.7s var(--ease-out);
}
a.project-video-wrap::after {
    content: "";
    position: absolute;
    inset: 0;
    background-color: color-mix(in srgb, var(--c-dark) 45%, transparent);
    transition: background-color 0.3s ease;
}
.video-play {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 1;
    transform: translate(-50%, -50%);
    display: inline-flex;
    align-items: center;
    gap: 0.7em;
    min-height: 56px;
    padding: 0 28px 0 22px;
    border-radius: var(--radius-pill);
    background-color: var(--c-primary-light);
    color: var(--c-dark);
    font-size: 1rem;
    font-weight: 600;
    white-space: nowrap;
    transition: background-color 0.22s ease;
}
.video-play-icon {
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 8px 0 8px 13px;
    border-color: transparent transparent transparent currentColor;
}
@media (hover: hover) {
    a.project-video-wrap:hover::after { background-color: color-mix(in srgb, var(--c-dark) 25%, transparent); }
    a.project-video-wrap:hover img { transform: scale(1.03); }
    a.project-video-wrap:hover .video-play { background-color: var(--c-light); }
}

/* Content sections: image + text, alternating sides */
.project-content {
    display: flex;
    flex-direction: column;
    gap: var(--section-pad);
    padding-bottom: var(--section-pad);
}
.project-section {
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    gap: var(--space-xl);
    align-items: center;
}
.project-section--reverse .project-section-img { order: 2; }
.project-section-img {
    border-radius: var(--radius-card);
    overflow: hidden;
    background-color: var(--c-dark-soft);
}
.project-section-img img {
    width: 100%;
    height: auto;
    transition: transform 0.7s var(--ease-out);
}
.project-section-img a {
    display: block;
    cursor: zoom-in;
}
.project-section-img a:focus-visible { outline-offset: -4px; }
@media (hover: hover) {
    .project-section-img:not(.compare):hover img { transform: scale(1.03); }
}

/* Before / after slider. The "before" image is clipped at --pos; a range
   input on top handles pointer, touch and keyboard (js/project-ui.js). */
.compare {
    position: relative;
    --pos: 50%;
}
.compare img { transition: none; }
.compare-before {
    position: absolute;
    inset: 0;
    height: 100%;
    object-fit: cover;
    clip-path: inset(0 calc(100% - var(--pos)) 0 0);
}
.compare-label {
    position: absolute;
    top: var(--space-sm);
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    background-color: color-mix(in srgb, var(--c-dark) 80%, transparent);
    font-size: var(--fs-label);
    font-weight: 500;
    color: var(--c-light);
    pointer-events: none;
}
.compare-label--before { left: var(--space-sm); }
.compare-label--after { right: var(--space-sm); }
.compare-range {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: ew-resize;
    touch-action: pan-y;
}
.compare-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--pos);
    width: 2px;
    margin-left: -1px;
    background-color: var(--c-light);
    pointer-events: none;
}
.compare-handle::after {
    content: "↔";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: var(--c-primary-light);
    color: var(--c-dark);
    font-size: 1.125rem;
    font-weight: 700;
}
.compare-range:focus-visible ~ .compare-handle::after {
    outline: 2px solid var(--c-light);
    outline-offset: 3px;
}
.project-section-num {
    display: block;
    font-size: var(--fs-label);
    font-weight: 500;
    letter-spacing: var(--ls-label);
    color: var(--c-primary-light);
    margin-bottom: var(--space-sm);
}
.project-section-text h2 {
    font-size: var(--fs-h3);
    margin-bottom: var(--space-sm);
}
.project-section-text p {
    max-width: 52ch;
}

/* Next project */
.next-project {
    position: relative;
    display: block;
    overflow: hidden;
    isolation: isolate;
    border-top: 1px solid var(--c-dark-muted);
}
.next-project img {
    position: absolute;
    inset: 0;
    z-index: -1;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.6;
    transition: opacity 0.5s ease, transform 0.9s var(--ease-out);
}
.next-project::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(to right, var(--c-dark) 0%, color-mix(in srgb, var(--c-dark) 50%, transparent) 70%, transparent 100%);
}
.next-project-inner {
    display: block;
    padding-top: var(--section-pad);
    padding-bottom: var(--section-pad);
}
.next-project-title {
    display: block;
    margin: var(--space-sm) 0 var(--space-xs);
    color: var(--c-light);
}
.next-project-sub {
    display: block;
    color: var(--c-gray);
    margin-bottom: var(--space-md);
}
@media (hover: hover) {
    .next-project:hover img { opacity: 0.85; transform: scale(1.03); }
    .next-project:hover .link-arrow::after { transform: translateX(4px); }
}
.project-all {
    padding: var(--space-md) 0;
    border-top: 1px solid var(--c-dark-muted);
}

/* RESPONSIVE ------------------------------------------------------------- */
@media (max-width: 900px) {
    .project-overview {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }
    .project-meta {
        flex-direction: row;
        flex-wrap: wrap;
        gap: var(--space-sm) var(--space-lg);
    }
    .project-section,
    .project-section--reverse {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }
    .project-section--reverse .project-section-img { order: 0; }
}
@media (max-width: 768px) {
    .project-hero { min-height: 70svh; }
    .project-hero-sub { font-size: 1.0625rem; }
    .project-content { gap: var(--space-xl); }
}

.project-links {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2xs);
}

/* Lightbox (a <dialog> built by js/project-ui.js) */
.lightbox {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: var(--space-lg) var(--space-sm) var(--space-sm);
    border: 0;
    background-color: color-mix(in srgb, var(--c-dark) 96%, transparent);
    color: var(--c-gray);
}
.lightbox[open] {
    display: grid;
    place-items: center;
    animation: lightboxIn 0.2s ease both;
}
@keyframes lightboxIn {
    from { opacity: 0; }
}
.lightbox::backdrop { background-color: var(--c-dark); }
.lightbox figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    max-width: 100%;
    max-height: 100%;
    min-height: 0;
}
.lightbox img {
    max-width: 100%;
    max-height: calc(100dvh - 9rem);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: var(--radius-card);
}
.lightbox figcaption {
    font-size: var(--fs-small);
    text-align: center;
}
.lightbox-btn {
    position: absolute;
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid var(--c-dark-muted);
    background-color: var(--c-dark-soft);
    color: var(--c-light);
    font-size: 1.125rem;
    cursor: pointer;
    transition: border-color 0.22s ease, background-color 0.22s ease;
}
.lightbox-btn:hover {
    border-color: var(--c-primary-light);
    background-color: var(--c-dark-muted);
}
.lightbox-close { top: var(--space-sm); right: var(--space-sm); }
.lightbox-prev { left: var(--space-sm); bottom: var(--space-sm); }
.lightbox-next { right: var(--space-sm); bottom: var(--space-sm); }
.lightbox--single .lightbox-prev,
.lightbox--single .lightbox-next { display: none; }
@media (min-width: 901px) {
    .lightbox-prev,
    .lightbox-next { bottom: auto; top: 50%; transform: translateY(-50%); }
    .lightbox { padding: var(--space-lg) 5rem var(--space-md); }
}
